ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* PDF Coloring.
@ 2000-10-10 12:03 Giuseppe Bilotta
  2000-10-11  8:51 ` Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-10-10 12:03 UTC (permalink / raw)


Hello, I discovered some sort of bug, but I don't know if the problem is
intrinsinc the PDF spec, or depends on some ConTeXt interaction with colors.
In the preamble I have the following code:

\def\RevNote#1{\inmargin{\startcolor[blue]#1\stopcolor}}
\def\complexRev[#1]#2{\leavevmode%
    \RevNote{#1}%
    \startcolor[red]#2\stopcolor%
}
\def\simpleRev#1{\leavevmode%
    \startcolor[red]#1\stopcolor%
}
\definecomplexorsimple\Rev

and in the text the following "application":

\Rev[some text]{some other text that spans multiple lines. Actually, it's
six or seven lines, but the important aspect is that there are more that one
line. etc etc etc}

Now, all the text should be colored in red, but for the "some text" in the
margin, that should be blue. Instead, the first lineof "some other text ..."
is red, the inmargin is blue, but the rest of the text is black, which is
wrong.

Actually, the original code used \color[red]{#1} et simil, so I thought that
it was a misuse of \color, and used \startcolor ... \stopcolor, finding that
the problem was still there.

A similar problem occurs with similar code:

\def\Miss#1{\inmargin{\startcolor[green]#1\stopcolor}}
\def\Synopsis#1%
  {{\tfxx\setupinterlinespace\startcolor[middlegreen]#1\stopcolor\par}}

When I have a \Miss{something} inside a Synopsis, the whole page gets the
color, instead of just the \Synopsis{ ... } part.

Any ideas on why is it this way?

Since we're talking colors: DVI come out black&white. How can I ensure that
color is used in DVIs too?

Giuseppe Bilotta


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

* Re: PDF Coloring.
  2000-10-10 12:03 PDF Coloring Giuseppe Bilotta
@ 2000-10-11  8:51 ` Hans Hagen
  2000-10-11  9:03 ` Hans Hagen
  2000-10-11  9:29 ` Hans Hagen
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-10-11  8:51 UTC (permalink / raw)
  Cc: ConTeXt

At 02:03 PM 10/10/00 +0200, Giuseppe Bilotta wrote:

>\def\complexRev[#1]#2{\leavevmode%

Using \leavevmode (no % needed here btw) is always dangerous and can spoil
spacing in terrible ways. Just \endgraf is ok, and in some cases the
context command \dontleavehmode is a better way to achieve the same effect.  

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: PDF Coloring.
  2000-10-10 12:03 PDF Coloring Giuseppe Bilotta
  2000-10-11  8:51 ` Hans Hagen
@ 2000-10-11  9:03 ` Hans Hagen
  2000-10-14 17:08   ` Giuseppe Bilotta
  2000-10-11  9:29 ` Hans Hagen
  2 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2000-10-11  9:03 UTC (permalink / raw)
  Cc: ConTeXt

At 02:03 PM 10/10/00 +0200, Giuseppe Bilotta wrote:

>and in the text the following "application":
>
>\Rev[some text]{some other text that spans multiple lines. Actually, it's

In context, [] is used for settings, not for optional text, so this macro
kind of voilates the interface. 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: PDF Coloring.
  2000-10-10 12:03 PDF Coloring Giuseppe Bilotta
  2000-10-11  8:51 ` Hans Hagen
  2000-10-11  9:03 ` Hans Hagen
@ 2000-10-11  9:29 ` Hans Hagen
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-10-11  9:29 UTC (permalink / raw)
  Cc: ConTeXt

At 02:03 PM 10/10/00 +0200, Giuseppe Bilotta wrote:
>Hello, I discovered some sort of bug, but I don't know if the problem is
>intrinsinc the PDF spec, or depends on some ConTeXt interaction with colors.

Actually it's both: an interaction between color switching and vadjust
which changed the order in the vertical list so that the stopcode end up
mixed. This is not an easy problem to solve.  

It does work ok with \margintext:

\def\Rev%
  {\dosingleempty\doRev}

\def\doRev[#1]%
  {\iffirstargument{\margintext{\color[blue]{#1}}}\fi
   \groupedcommand{\startcolor[red]}{\stopcolor}}

But, i would prefer the following,

\def\startRev#1%
  {\margintext{\color[blue]{#1}}%
   \startcolor[red]}

\def\stopRev%
  {\stopcolor}

\startRev{some text}
bla bla 
\stopRev

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: PDF Coloring.
  2000-10-11  9:03 ` Hans Hagen
@ 2000-10-14 17:08   ` Giuseppe Bilotta
  2000-10-15 20:01     ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-10-14 17:08 UTC (permalink / raw)
  Cc: ConTeXt

> At 02:03 PM 10/10/00 +0200, Giuseppe Bilotta wrote:
>
> >and in the text the following "application":
> >
> >\Rev[some text]{some other text that spans multiple lines. Actually, it's
>
> In context, [] is used for settings, not for optional text, so this macro
> kind of voilates the interface.
>

Ok, so I need something like \definecomplexorsimple\Rev, but working with
{}{} instead of []{}. How do I do it? Also, how do I (possibily at the same
time) define an analogous start...stop couple (\startRev ... \stopRev,
spanning multiple paragraphs, but still accepting an {optional text}
argument)?

Giuseppe Bilotta

----- Original Message -----
From: Hans Hagen <pragma@wxs.nl>
To: Giuseppe Bilotta <oblomov@freemail.it>
Cc: ConTeXt <ntg-context@ntg.nl>
Sent: Wednesday, October 11, 2000 11:03 AM
Subject: Re: PDF Coloring.


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

* Re: PDF Coloring.
  2000-10-14 17:08   ` Giuseppe Bilotta
@ 2000-10-15 20:01     ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-10-15 20:01 UTC (permalink / raw)
  Cc: Hans Hagen, ConTeXt

At 07:08 PM 10/14/00 +0200, Giuseppe Bilotta wrote:
>
>
>> At 02:03 PM 10/10/00 +0200, Giuseppe Bilotta wrote:
>>
>> >and in the text the following "application":
>> >
>> >\Rev[some text]{some other text that spans multiple lines. Actually, it's
>>
>> In context, [] is used for settings, not for optional text, so this macro
>> kind of voilates the interface.
>>
>
>Ok, so I need something like \definecomplexorsimple\Rev, but working with
>{}{} instead of []{}. How do I do it? Also, how do I (possibily at the same
>time) define an analogous start...stop couple (\startRev ... \stopRev,
>spanning multiple paragraphs, but still accepting an {optional text}
>argument)?

take a look at syst-gen.tex and you will find "...groupempty" commands 

But, when you want to span multiple pars, it's always better not to use {}
but a proper start stop. You may want to play with: 

you can always say:

\def\startRev#1{...\bgroup}
\def\stopRev{...\egroup}

\def\Rev#1#2{\startRev{#1}#2\stopRev}

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

end of thread, other threads:[~2000-10-15 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-10 12:03 PDF Coloring Giuseppe Bilotta
2000-10-11  8:51 ` Hans Hagen
2000-10-11  9:03 ` Hans Hagen
2000-10-14 17:08   ` Giuseppe Bilotta
2000-10-15 20:01     ` Hans Hagen
2000-10-11  9:29 ` Hans Hagen

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