ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mojca Miklavec <mojca.miklavec.lists@gmail.com>
Subject: Re: tweaking underlining
Date: Mon, 11 Jul 2005 23:33:56 +0200	[thread overview]
Message-ID: <6faad9f005071114334df96298@mail.gmail.com> (raw)
In-Reply-To: <1120862975.9027.24.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 4082 bytes --]

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

[-- Attachment #2: test4.tex --]
[-- Type: application/x-tex, Size: 960 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

      parent reply	other threads:[~2005-07-11 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-08 22:49 Stuart Jansen
2005-07-09  9:19 ` Hans Hagen
2005-07-15 23:04   ` Stuart Jansen
2005-07-11 21:33 ` Mojca Miklavec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6faad9f005071114334df96298@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).