Am 25.05.2011 um 18:02 schrieb Mathieu DUPONT:


When I run this code, every lines of the TOC become 2.8ex.
What I needed is every lines to be 2.8ex, except for the last line of each title, which should be 4.2 ex.
In other words, all short titles that fit on one line will be 4.2ex (they're all last lines), but, only for the long titles on multiple lines, their first lines will be 2.8ex and their last line will be 4.2ex.
To resume the result I seek, the TOC is 4.2ex, but when a long title is on multiple lines it should stick together (2.8ex).

You want something like this?

\starttext

\setbox0\vbox{\input ward\par}

\doloop
  {\setupinterlinespace[line=2.8ex]
   \ifdim\ht0<\lineheight
     \setupinterlinespace[line=4.2ex]
     \box0
     \exitloop
   \else
     \setbox2\vsplit0 to \baselineskip
     \box2
   \fi}

\stoptext

Wolfgang