[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Preview FAQ: colors

From: Julien Rioux
Subject: [AUCTeX-devel] Preview FAQ: colors
Date: Sun, 11 Sep 2011 18:37:32 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2

How to customize foreground and background colors in previews, compatible with the tightpage option, and both dvips and pdflatex backends?


Ideally, with a preamble such as


the output would have red text on blue background on each page, and the correct tight bounding box. But this is not the case: only the \pagecolor is understood and only by pdflatex.

We can add hooks to each preview to add the foreground color.


It works. Well, what about adding the \pagecolor there as well? The problem is that the special postscript code from \pagecolor interferes with the postscript code generated by the tightpage option (the bounding box info appears after the color info in the generated postscript, but it should appear before). Nevermind, we'll generate our own. The relevant code is

\color{blue}\special{ps::clippath fill}

In order to avoid warning messages about special postscript code in the output file when executing pdflatex, we wrap this with a check for the dvips option.

Another problem is that space is introduced within the shipout box. So instead of redefining \preview, we'll redefine address@hidden@end. This is a shipout hook allowing us to manipulate the preview box without changing its size.

Complete minimal example attached. Process through latex, dvips and ghostcript, using gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 -dGraphicsAlphaBits=4 -dSAFER -q -dNOPAUSE -sOutputFile="eta%d.png" "" -dBATCH

The same for pdflatex and ghostscript.



Attachment: minimal.tex
Description: TeX document

Attachment: eta1.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]