[NTG-context] dashed underbar

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Apr 5 22:29:50 CEST 2011


Am 05.04.2011 um 22:07 schrieb Daniel Schopper:

> Dear all,
> I'm looking for a solution for dashed underlining. Hacking around I've come quite close, with the only problem that when the underlining begins at the start of a paragraph there gets an empty (grid) line inserted before it. See:
> 
> \defineoverlay [backgraphics] [\positionoverlay{backgraphics}]
> \setupbackgrounds
>  [page]
>  [background={backgraphics}]
> 
> \setupMPvariables[mpos:par][gridtype=1,gridshift=-0.5ex,gridwidth=0.1ex, gridcolor=black,fillcolor=white,linecolor=white]
> 
> \newcount\dashulinecounter \dashulinecounter=1
> 
> \definestartstop[dashuline][before={\dostartdashuline},after={\dostopdashuline}]
> \def\dostartdashuline{%
> 	\startpositionoverlay{backgraphics}%
> 	 \setMPpositiongraphic{b:uline:\the\dashulinecounter}{mpos:par}{self=uline:\the\dashulinecounter}%
> 	\stoppositionoverlay
> 	\fpos{uline:\the\dashulinecounter}%
> }
> \def\dostopdashuline{%
> 	\tpos{uline:\the\dashulinecounter}%
> 	\advance\dashulinecounter by 1%
> }
> 
> 
> \starttext
> No Line \startdashuline \dorecurse{20}{This is just a test. }\stopdashuline \par
> \startdashuline \dorecurse{20}{This is just a test. }\stopdashuline
> \stoptext
> 
> I'm sure some of you know a simpler and more elegant solution that maybe allows even dotted underlining?! Or does anyone have a hint how to get rid of the empty line?

\definetextbackground
  [dashed]
  [   location=text,
    framecolor=black,
   alternative=1,
       voffset=-\strutdp,
    background=,
         frame=off,
          dash=1]

\starttext
\startdashed\input ward \stopdashed
\stoptext

Wolfgang




More information about the ntg-context mailing list