ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Colored text's background, which the more "lcd-mkiv"?
@ 2014-01-17 16:33 Elspeth McGullicuddy
  2014-01-17 17:16 ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-17 16:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[Colored text's background, which the more "lcd-mkiv"?;
plus: Metapost variable "text" with "\definetextbackground";
plus: {\input ward}]

Hi list,

What would be the best, also the more up to date, way to put colored
background behind text, that could cross page boundaries.

I have found three ways of doing this: I would like to know which is
best practice, and also the more "lua context document" fashion.

1- Using "\startbar[underbar] \input zapf \stopbar" as described p. 39
of "hybrid.pdf".

2- Using "\startMPpositionmethod{mpos:placeholder}", found in
http://tex.stackexchange.com/questions/125162/rounded-box-around-placeholder-text-that-supports-line-breaking/125323
(Thanks to Aditya).
A bit tricky, but perhaps the more versatile or universal?

3- Start with: "\definetextbackground" (same ref. as previous).

%%%%%%%%%%%%%

% About the third one I have had some difficulties, that might be
thought of as a bug.
% You might want and try the following example: it doesn't work if you
have a MetaPost variable
% whose name is "text".

\starttext

\startMPcode

%  numeric text; %% Try and uncomment this line

  drawarrow (0,0)--(3cm,1cm);
\stopMPcode

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\definecolor [lightblue] [r=0.5, g=0.5, b=1]

\definetextbackground
    [placeholder]
    [
      location=text,
      background=color,
      backgroundcolor=lightblue,
      frame=on,
      corner=round,
      radius=0.8\lineheight,
    ]

\placeholder{\input ward }

% \placeholder{\input ward} %% Try and uncomment this line

\stoptext


% Local Variables:
% mode: context
% coding: utf-8
% End:

Regards,
Chris
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Colored text's background, which the more "lcd-mkiv"?
  2014-01-17 16:33 Colored text's background, which the more "lcd-mkiv"? Elspeth McGullicuddy
@ 2014-01-17 17:16 ` Aditya Mahajan
  2014-01-17 19:33   ` Elspeth McGullicuddy
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2014-01-17 17:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 17 Jan 2014, Elspeth McGullicuddy wrote:

> [Colored text's background, which the more "lcd-mkiv"?;
> plus: Metapost variable "text" with "\definetextbackground";
> plus: {\input ward}]
>
> Hi list,
>
> What would be the best, also the more up to date, way to put colored
> background behind text, that could cross page boundaries.
>
> I have found three ways of doing this: I would like to know which is
> best practice, and also the more "lua context document" fashion.
>
> 1- Using "\startbar[underbar] \input zapf \stopbar" as described p. 39
> of "hybrid.pdf".

Use this one, unless the underbars are indequate, as was the case for the 
OP of the TeX.SX question.

> 2- Using "\startMPpositionmethod{mpos:placeholder}", found in
> http://tex.stackexchange.com/questions/125162/rounded-box-around-placeholder-text-that-supports-line-breaking/125323
> (Thanks to Aditya).
> A bit tricky, but perhaps the more versatile or universal?
>
> 3- Start with: "\definetextbackground" (same ref. as previous).
>
> %%%%%%%%%%%%%
>
> % About the third one I have had some difficulties, that might be
> thought of as a bug.
> % You might want and try the following example: it doesn't work if you
> have a MetaPost variable
> % whose name is "text".


(Untested). Normally this means that there is already a variable with the 
name text. You can use:

save text; numeric text;

or

newnumeric text;

which is shortcut for the former.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Colored text's background, which the more "lcd-mkiv"?
  2014-01-17 17:16 ` Aditya Mahajan
@ 2014-01-17 19:33   ` Elspeth McGullicuddy
  0 siblings, 0 replies; 3+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-17 19:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Jan 17, 2014 at 6:16 PM, Aditya Mahajan <adityam@umich.edu> wrote:
> On Fri, 17 Jan 2014, Elspeth McGullicuddy wrote:
>
>> [Colored text's background, which the more "lcd-mkiv"?;
>> plus: Metapost variable "text" with "\definetextbackground";
>> plus: {\input ward}]
>>
>> Hi list,
>>
>> What would be the best, also the more up to date, way to put colored
>> background behind text, that could cross page boundaries.
>>
>> I have found three ways of doing this: I would like to know which is
>> best practice, and also the more "lua context document" fashion.
>>
>> 1- Using "\startbar[underbar] \input zapf \stopbar" as described p. 39
>> of "hybrid.pdf".
>
>
> Use this one, unless the underbars are indequate, as was the case for the OP
> of the TeX.SX question.

This one is very easy to use, but I liked the rounded corners of the example.
Also I want it to fill the whole background, as it is the case with
\definetextbackground: it starts where you tell it to start, then fill
the whole text area, not only where there actually are glyphs, so it
keeps going on even if you put a \pagebreak, and stop when you tell it
to stop.
Instead \startbar[underbar] put color only where there are glyphs,
which is not what I'm looking for, unless there is way to do other
wise, but it would contradict the name underbar, so it seems unlikely.

So I think I'll go to \definetextbackground. And try some experiments
with the "MPposition" stuffs.

>
>> 2- Using "\startMPpositionmethod{mpos:placeholder}", found in
>>
>> http://tex.stackexchange.com/questions/125162/rounded-box-around-placeholder-text-that-supports-line-breaking/125323
>> (Thanks to Aditya).
>> A bit tricky, but perhaps the more versatile or universal?
>>
>> 3- Start with: "\definetextbackground" (same ref. as previous).
>>
>> %%%%%%%%%%%%%
>>
>> % About the third one I have had some difficulties, that might be
>> thought of as a bug.
>> % You might want and try the following example: it doesn't work if you
>> have a MetaPost variable
>> % whose name is "text".
>
>
>
> (Untested). Normally this means that there is already a variable with the
> name text. You can use:

Yes it's what I gathered. It took me some time to do so, though.

I didn't know of the "nuewnumeric" which is a good shortcut.

Thanks for this quick answer,
Chris

>
> save text; numeric text;
>
> or
>
> newnumeric text;
>
> which is shortcut for the former.
>
> Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-17 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-17 16:33 Colored text's background, which the more "lcd-mkiv"? Elspeth McGullicuddy
2014-01-17 17:16 ` Aditya Mahajan
2014-01-17 19:33   ` Elspeth McGullicuddy

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).