[OS X TeX] How to find coloured pages automatically?

Chris Goedde cgoedde at condor.depaul.edu
Wed Jan 19 18:05:55 CET 2005


This should be doable, but probably not from the the TeX file.

Here's what I would try; there are probably better ways. I doubt that 
there is a prepackaged solution, but would be interested to hear if 
there is. My method requires some programming if you want to automate 
it.

First, I would work with a PS file, not a PDF file. Assuming you're 
using TeXShop, you can set
the preferences to use dvips and tell TeXShop to keep the PS file.

The simplest thing would be just to double-click on the PS file, let 
Preview open it, and figure out which pages have color. If you want to 
automate this step, you could do the following: Look through the PS 
file in a text editor for the color commands. These will be things like 
"setrgbcolor". (You could search for just "color", I think.) Page 
numbers will be identified by lines like: %%Page: 10 10. You could then 
write a perl or shell or awk script to figure out which pages contain 
the color figures. This is left as an exercise for the reader :-).

Once you know which pages have the color figures, there is a UNIX 
utility called "psselect" that allows you to print certain pages of a 
PS file. It should be installed on your system if you installed TeX via 
i-Installer. You can open up a terminal window and type "which 
psselect" to see if you have it and "man psselect" to see how to use 
it.

Chris

On Jan 19, 2005, at 9:31 AM, Guido Mocken wrote:

> Hi,
>
> is there an easy way (a LaTeX package?) to find all pages of a rather 
> long document that contain color?
>
> I have to print out about six copies of a ~240 pages document.
> Of course, I want to keep down the costs for printing, that's why I am 
> asking.
>
> Usually, colour only appears inside figure-environments, but not all 
> figures are coloured.
> The document has to be printed double-sided, so any even page 
> preceeded by a coloured page and any odd page followed by a coloured 
> page has to count as a coloured one, too.
>
> I would like to generate two separate PDF files from the original one 
> (or its Latex source), one containg the coloured pages, and one 
> containing the black-and-white pages.
>
> Any ideas, hints, suggestions?
>
> 	Guido
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list