Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Something weird in pdf viewers...

78 views
Skip to first unread message

Jellby

unread,
Nov 12, 2006, 6:20:46 AM11/12/06
to
Hi all,

I've found a weird behaviour in pdf viewers. It's not exactly related with
TeX, but I've found it with a file created with LaTeX, and since it happens
with both acroread and ghostview, I guess it's something in the pdf, and
not only the viewer.

The thing is, when I create a picture with transparency, the text from that
point (and sometimes from the page *before*) is displayed differently.
Consider this test document:

%========================================================
\documentclass{article}
\usepackage{tikz}
\begin{document}

Test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test
\clearpage
Test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test

\begin{figure}[p]
\begin{tikzpicture}
\fill[red] (0,0) rectangle (4,4);
\fill[blue,opacity=0.55] (2,2) rectangle (6,6);
\end{tikzpicture}
\end{figure}

\clearpage
Test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test
\clearpage
Test test test test test test test test test test test test test
test test test test test test test test test test test test test
test test test test test test test test test test test test test

\end{document}
%========================================================

It's just 4 identical pages and a figure in page 3. But pages 1 and 2 are
not displayed the same in acroread (version 7.0.0, 3/11/2005 under linux,
with text smoothing enabled), the text in page 2 is slightly darker than in
page 1. I guess the difference is only in screen, and it's minimal (if any)
at high magnification.

With gv (version 3.6.1), I also see a difference, but now page 2 looks as if
it's not antialiased. Actually, I don't see any difference in page 2 when I
enable/disable the antialiasing, and I do in page 1. With xpdf (version
3.00) all pages look the same, but it does not support transparency anyway.

Pages 4 and 5 (after the figure) are displayed exactly like page 2 in all
cases. Adding a \clearpage before the figure "fixes" page 2, but pages 4
and 5 are still displayed differently (from pages 1 and 2), so I guess
there is something with the figure being defined while typesetting page 2,
even though it then moves to page 3.

If I delete the opacity option, everything's fine, all pages look the same.
I wonder if this is really a problem with the viewers or a "bug" in tikz;
I'm using version 1.01, by the way, but I'm now with some important work
and I don't want to update until it's finished.

Do you also see a difference in the text with other systems/viewers? I can
provide a screenshot if someone is interested, but unfortunately my web
server is down (for a long time), so it would have to be by mail or to some
free webspace (suggestions?). Can anyone see what's happening?

Thanks for reading.

PS. Oh, and I'm using pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4).

--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \
/ /_/__\ \ \
/________\ \ \
jellby \___________\/ yahoo.com

Robin Fairbairns

unread,
Nov 12, 2006, 2:26:56 PM11/12/06
to
Jellby <m...@privacy.net> writes:
>I've found a weird behaviour in pdf viewers. It's not exactly related with
>TeX, but I've found it with a file created with LaTeX, and since it happens
>with both acroread and ghostview, I guess it's something in the pdf, and
>not only the viewer.
>
>The thing is, when I create a picture with transparency, the text from that
>point (and sometimes from the page *before*) is displayed differently.

are you using pdflatex? have you tried the pdfcolmk package?
--
Robin Fairbairns, Cambridge

Kjell Magne Fauske

unread,
Nov 13, 2006, 4:00:08 AM11/13/06
to
I observe the same change in 'text darkness' with Adobe Acrobat
Professional 7.0 on WinXP. I'm using PGF/TikZ version 1.10. Loading the
pdfcolmk didn't change anything.

I've observed something similar when using PNG images in Beamer
presentations. It is probably related since PNG supports transparency.

- Kjell Magne

William F. Adams

unread,
Nov 13, 2006, 10:13:38 AM11/13/06
to
It's a function of how .pdf is displayed by .pdf viewing programs.

Turning on transparency forces things into RGB colourspace, which
results in black having a different appearance than it does when
previewing black ink on paper --- there're options which can influence
this, but I've always just found it expedient to ignore it.

William
(who wishes Adobe had licensed Cerilica's Truism ink representation
technology so this sort of thing would be represented w/ more
verisimilitude)

Jellby

unread,
Nov 12, 2006, 2:34:35 PM11/12/06
to
Among other things, Robin Fairbairns saw fit to write:

>>The thing is, when I create a picture with transparency, the text from
>>that point (and sometimes from the page *before*) is displayed
>>differently.
>
> are you using pdflatex? have you tried the pdfcolmk package?

Yes, I'm using pdflatex. Yes, I tried pdfcolmk with the test file and I see
no difference. Note that I'm not using coloured text at all, the colour and
transparency are confined in the tikzpicture (and figure) environment,
which does not extend across pages. Note, too, that what I see is not
something very striking, it's just that the text seems to be
smoothed/antialiased differently, a slight but noticeable difference. I
didn't try printing, but it will probably be ok there.

--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \

http://djelibeibi.unex.es

RS

unread,
Nov 15, 2006, 5:39:33 PM11/15/06
to
On 12.11.2006 12:20, Jellby wrote:
> The thing is, when I create a picture with transparency, the text from that
> point (and sometimes from the page *before*) is displayed differently.

I have no idea whether pgf could be changed to better encapsulate
transparency. However, to make subsequent pages appear normal, you can
insert \pdfpageresources{} on the page after the graphic.

Regards,
--
Robert

Jellby

unread,
Nov 19, 2006, 11:16:52 AM11/19/06
to
Among other things, RS saw fit to wrie:

> I have no idea whether pgf could be changed to better encapsulate
> transparency. However, to make subsequent pages appear normal, you can
> insert \pdfpageresources{} on the page after the graphic.

Hmm... It could be useful. Any idea on how to "automate" it? It's rather
difficult to know where a floating picture will end. I've tried using
\afterpage and putting it in the headers code (hoping that it would be set
for every page and overwritten when needed by the transparency code) to no
avail.

--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \

http://djelibeibi.unex.es

RS

unread,
Nov 19, 2006, 6:22:24 PM11/19/06
to
On 19.11.2006 17:16, Jellby wrote:
> Hmm... It could be useful. Any idea on how to "automate" it? It's
> rather difficult to know where a floating picture will end.

How about:

\begin{figure}
...
\afterpage{\global\pdfpageresources{}}
\end{figure}

It is unfortunate that pdftex doesn't provide the analogue to
\pdfpageattr (which only applies to the current page, in contrast to
\pdfpagesattr) for the resources. A feature request might be worthwhile.


Regards,
--
Robert

Heiko Oberdiek

unread,
Nov 19, 2006, 9:03:28 PM11/19/06
to
RS <w....@gmx.net> wrote:

No. \pdfpageattr and \pdfpagesattr do not help either.
A standard mediator package is needed that controls the
contents of such registers and defines an interface for other
packages, because:
* several packages might want to use
\pdfpageresources/\pdfpage(s)attr.
The mediator package would ensure that all requests
are handled and not overwritten, how it can be seen
above: \global\pdfpageresource{}, deadly, if some
package relies on its page resource setting.
* Often it makes sense to change entries, thus the
specific entry must be deleted before and added
with new contents. But the other settings in the
register must not be changed or deleted.

Yours sincerely
Heiko <ober...@uni-freiburg.de>

j...@amrita-ebook.org

unread,
Nov 20, 2006, 5:56:28 PM11/20/06
to
Jellby wrote:

> The thing is, when I create a picture with transparency, the text from that
> point (and sometimes from the page *before*) is displayed differently.
> Consider this test document:
>

A workaround that I use to this problem is to add transparent content
using /Widget annotation's. A minimal example is:

\documentclass{article}
\begin{document}
\newbox\myBox\newbox\myApp
\setbox\myBox=\hbox{%
\pdfliteral{/myOpacity gs}%
Here is some text with 50\% opacity}
\setbox\myApp=\hbox{\copy\myBox}
\immediate\pdfobj{<< /Type /ExtGState /ca 0.5 /CA 0.5 /BM /Normal>>}
\immediate\pdfxform
resources {/ExtGState << /myOpacity \the\pdflastobj\space 0 R
>>}
\myApp
\noindent Here is some opaque text\\
\pdfannot
width \wd\myBox\space
height \ht\myBox\space
depth \dp\myBox {%
/Subtype /Widget /F 4 /FT /Btn /Ff 5 /T (myWidget)
/AP << /N \the\pdflastxform\space 0 R >>
}\\
Here is some opaque text
\end{document}

This approach might seem to be a bit on the clumsy side, but it is
possible
to hide the gory details using TeX macros.

James

j...@amrita-ebook.org

unread,
Nov 20, 2006, 6:05:16 PM11/20/06
to
Aaaaggghhh!!! Google's message formatting introduced a blank line
that breaks my minimal example. So here goes a second time:

\documentclass{article}
\begin{document}
\newbox\myBox\newbox\myApp
\setbox\myBox=\hbox{%
\pdfliteral{/myOpacity gs}%
Here is some text with 50\% opacity}
\setbox\myApp=\hbox{\copy\myBox}
\immediate\pdfobj{<< /Type /ExtGState /ca 0.5 /CA 0.5 /BM /Normal>>}
\immediate\pdfxform
resources {
/ExtGState <<
/myOpacity \the\pdflastobj\space 0 R
>>}
\myApp
\noindent Here is some opaque text\\
\pdfannot
width \wd\myBox\space
height \ht\myBox\space
depth \dp\myBox {%
/Subtype /Widget /F 4 /FT /Btn /Ff 5 /T (myWidget)
/AP << /N \the\pdflastxform\space 0 R >>
}\\
Here is some opaque text
\end{document}

James

0 new messages