[NTG-context] Rule under length of last line

Hans Hagen pragma at wxs.nl
Mon Jul 31 21:12:40 CEST 2006

Taco Hoekwater wrote:
> Duncan Hothersall wrote:
>
>> We generate the ConTeXt code from XML, so ideally a solution wouldn't
>> require the last line to be set separately, but would just work whether
>> the heading was single or multiple line. What I'm really looking for is
>> a subsection setup that will automatically do this whatever length of title.
>>
>
> It is easier than you think:
>
>    \def\Myway#1%
>      {#1\vrule height 0pt depth 6pt width 0pt}% title + force 6pt
>       \optimizedisplayspacingtrue\setlastlinewidth % core-mat macro
>       \hrule width \the\lastlinewidth}
>
>
> The key element is \setlastlinewidth, which measures the width
> of the final line of the current paragraph.
>
i was thinking of that as a third solution but somehow you trust \setlastlinewidth more than i do -)

Hans

-----------------------------------------------------------------