Stuart Jansen wrote:
Reading the list archives, it looks like there are certain advantages, to performing underlining according to my example below:
===== \setupcolors[state=start] \definetextbackground[underline][location=text,alternative=1,background=,frame=off] \definestartstop [underline] [before={\starttextbackground[underline]}, after=\stoptextbackground] \starttext \startunderline{}http://gurulabs.com/\stopunderline \stoptext =====
I would like to tweak this a little however. Specifically, I'd like to change the color of the line and move it down a point or two.
The quick way to do it (but probably not the one you would really like): \definetextbackground [underline] [location=text, alternative=2, frame=off, bottomframe=on, framecolor=red, rulethickness=1pt] Even if you're satisfied with it, there's one problem. In every line there are two lines drawn: above and below the text. This leads to the (probably undesired) result: the first and the last rule are only half so thick as the rest.
In one thread, Hans hinted how to do this:
you can redefine the metapost graphic, the main thing there is that you draw/fill something related to the multipar paths; it takes a bit of experimenting, but after a while you start seeing possibilities. See plus-rul.tex for an example of such a graphic.
I think I've tracked this reference down to the definition of mpos:par:columnset, but at this point am lost as to how to proceed. Metapost is still beyond me. Any hints would be much appreciated.
Metapost graphics for backgrounds are doable once you understand some basics about metapost (MetaFun tutorial, Learning metapost by doing, Metapost manual, ...). Here's an example: \startuniqueMPgraphic{MyGraphic1} draw unitsquare xscaled \overlaywidth yscaled \overlayheight withcolor red; \stopuniqueMPgraphic \startuniqueMPgraphic{MyGraphic2} save r, dist, offset; numeric r, dist, offset; % circle radius r := 3pt; % distance between two circles dist := 1cm; % distance between the bottom frame margin and the center of my pattern offset := 5pt; for i=0 upto floor((\overlaywidth-2r)/dist): draw fullcircle scaled 2r shifted (i*dist+r,-offset) withcolor blue; endfor; setbounds currentpicture to unitsquare xscaled \overlaywidth yscaled \overlayheight; \stopuniqueMPgraphic \defineoverlay [myframe1] [\uniqueMPgraphic{MyGraphic1}] \defineoverlay [myframe2] [\uniqueMPgraphic{MyGraphic2}] \framed[background=myframe1,frame=off]{abc} % what does a linebreak after \framed[...]{...} do? \framed[background=myframe2,frame=on]{\dorecurse{15}{bla }}abc\crlf \framed[background=myframe2,frame=off]{\dorecurse{17}{bla }} However, I have no idea how to apply the same to the underlining scheme of paragraphs. Saying \definetextbackground [underline] [location=text, alternative=2, background=myframe2] has absolutely no influence on how the frames are drawn. mpos:par:columnset is a name of a metapost graphic, defined in core-pos.tex. However, I tried to play with \definetextbackground [underline] [... mp=oneofmygraphics ...] which should change the background graphic, but also without any success. I thought also that perhaps making something like \setupMPvariables [mpos:par:columnset] [linecolor=red, linewidth=10pt] would have any influence of how the frames are drawn, but it doesn't. My other try was trying to change the example on page 43/44 of columns.pdf. I replaced the whole body of {mpos:par:columnset:shade} graphic by a single statement, draw multipars[1] withcolor green; This works (it draws a frame around the whole paragraph in the first column), but I didn't find out how to access the variable with the bounding box of one line only. An interesting observation (feature/bug or maybe just a stupid usage?): Try to compile the example attached in the file. Mojca