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? Cheers, Daniel
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
Well, that was really simple… Any chance to get this working also with dots? (Where could I find more on those features? I guess anch-pgr.mkiv which seems quite complicated…) Thanks a lot! Am 05.04.11 22:29, schrieb Wolfgang Schuster:
\definetextbackground [dashed] [ location=text, framecolor=black, alternative=1, voffset=-\strutdp, background=, frame=off, dash=1]
\starttext \startdashed\input ward \stopdashed \stoptext
Sorry to bother you again… Unfortunately this doesn't work out right in descriptions: after the first line the underlining starts at the left margin not with the other indented lines. Anything one can do about this? Thanks! \definetextbackground [dashed] [ location=text, framecolor=black, alternative=1, voffset=-1.2\strutdp, background=, frame=off, dash=1] \definedescription [desc] [ width=2em, headstyle=normal] \starttext \startdesc{Desc:}\startdashed\input ward\stopdashed\stopdesc \stoptext
\definetextbackground [dashed] [ location=text, framecolor=black, alternative=1, voffset=-\strutdp, background=, frame=off, dash=1]
\starttext \startdashed\input ward \stopdashed \stoptext
Hello, I tried to add the Wolfgang's solution to wiki, the last example on http://wiki.contextgarden.net/TextBackground But the rendered example doesn't show any (dashed) background, although the standalone test file does. Why? If the example was rendered otherwise than in reality, it wouldn't have sense to keep it on wiki... Lukas
\definetextbackground [dashed] [ location=text, framecolor=black, alternative=1, voffset=-\strutdp, background=, frame=off, dash=1]
\starttext \startdashed\input ward \stopdashed \stoptext
Wolfgang
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On Fri, 8 Apr 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
I tried to add the Wolfgang's solution to wiki, the last example on
http://wiki.contextgarden.net/TextBackground
But the rendered example doesn't show any (dashed) background, although the standalone test file does.
Why?
The underbar is drawn using metapost. The wiki still uses MkII, and does not have write18 enabled. So, you need to add \runMPgraphicsfalse in the file (I think that that should be added to cont-usr.tex on the wiki). Aditya
2011/4/8 Aditya Mahajan wrote:
On Fri, 8 Apr 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
I tried to add the Wolfgang's solution to wiki, the last example on
http://wiki.contextgarden.net/TextBackground
But the rendered example doesn't show any (dashed) background, although the standalone test file does.
Why?
The underbar is drawn using metapost. The wiki still uses MkII, and does not have write18 enabled. So, you need to add \runMPgraphicsfalse in the file (I think that that should be added to cont-usr.tex on the wiki).
I have added that command before \starttext in the wiki extension. Aditya - can you please test it? Mojca
On Sun, 10 Apr 2011, Mojca Miklavec wrote:
2011/4/8 Aditya Mahajan wrote:
On Fri, 8 Apr 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
I tried to add the Wolfgang's solution to wiki, the last example on
http://wiki.contextgarden.net/TextBackground
But the rendered example doesn't show any (dashed) background, although the standalone test file does.
Why?
The underbar is drawn using metapost. The wiki still uses MkII, and does not have write18 enabled. So, you need to add \runMPgraphicsfalse in the file (I think that that should be added to cont-usr.tex on the wiki).
I have added that command before \starttext in the wiki extension.
Aditya - can you please test it?
If I remove \runMPgraphicsfalse from the last example on http://wiki.contextgarden.net/TextBackground, I do not get the underbar. Aditya
participants (5)
-
Aditya Mahajan
-
Daniel Schopper
-
Mojca Miklavec
-
Procházka Lukáš Ing. - Pontex s. r. o.
-
Wolfgang Schuster