Graphics, Figures & TablesExtract Pages with Figures on them

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kbphd
Posts: 1
Joined: Tue Nov 01, 2011 7:44 am

Extract Pages with Figures on them

Post by kbphd »

Hi,

I'm printing a large document (PhD thesis) and trying to save money by printing in B/W and printing the color pages separately.

I was thinking one approach was to output the page numbers to a text file and extract those pages using pdftk (or something like that).

I tried doing:

Code: Select all

\newcommand{\resetfigpage}{\immediate\write18{rm -f figpages.txt}}
\newcommand{\savefigpage}{\immediate\write18{echo Figure \thefigure\space on page \thepage\space >> figpages.txt}}
\makeatletter
\renewenvironment{figure}
           {\@float{figure}}
           {\savefigpage\end@float}
\makeatother
But: the page numbers in figpages.txt were:

1. The with respect to the beginning of the main matter (i.e. didn't include about 12 roman-numeralled preamble pages).

2. Off by 1 on many occasions.

I'm thinking maybe the problem with the off by 1 is related to using the \renewenvironment{figure} rather than \renewcommand{\includegraphics}, but I couldn't work out how to do the latter.

Do you use \let?
How do you override the optional arguments for \includegraphics?
Would that at least help with my off by 1?

Cheers,

K

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Extract Pages with Figures on them

Post by kaiserkarl13 »

The fancyhdr package defines an \iffloatpage command that may help you. I recommend writing something to an aux-like file and then parsing that to get the pages you want. You may be able to use the pagesel package, but only if you have a list of numbers.

Looking at the code in the pagesel package might give you some ideas on how to do this automatically (if you're brave and have time to tinker).
Post Reply