[comp.unix.questions] @@102

leff%smu.csnet@RELAY.CS.NET (Laurence Leff) (10/07/87)

I want to make a macro that will take as an argument a string
and produce as indicated below.

If string is sufficiently short, then we get

1 adsf adsf asdf asdf adsf adsf adf adf asdf adsfads asdf............... 15

Otherwise we will get
1 adf adsf adsf asdf adsf asdf adsfasdf adsfasdf asdf asdf adsf adsf
  adfasdf adsfaf adsfadsf adsfasdf adsfasdf asdfadsf adsfasdf .......... 17

Or

2 adsfasdf adsfasdf adsfadsf adsfadsf adsfadsfasdf asdfasdf asdfasdf
  adsfadsf adsfasdfasdfadsfasdf asdfasdfasd fadsfadsf asdfasdf asdfads
  adsfadsf adsfadsfasdfadsf adsfasdfadsf asdf dsaf .................... 19

Basically, I am writing a table of contents and list of figures generation
system for thesis.  
It works great when the chapter title or figure caption is short
enough so the entry for same fits on one line.
I would like to generalize as above.

P. S. Actually, the line is being diverted into a macro, the page number
and figure number of chapter number is computed and put in and then
the macro is printed at the end of the thesis automatically.  I don't
think that makes any difference.