[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
>       \global\advance\lastlinewidth-\hangindent\par % adjust
>       \hrule width \the\lastlinewidth}
>
>    \setuphead[section][textcommand=\Myway]
>
> 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 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list