24

Most of my document is black text, but there is a color figure here and there. I would like to print the text on a black and white printer, and the figures on a color printer. I know i could just select the pages with figures and print them whole on the color printer, but then the text would look different.

Is there a way (in PDF Latex) to generate two separate versions of the document, one with only the text, but with space left for the figures, and the other with the figures only, but in their proper positions, so that i can print the two versions on top of one another? I'm willing to manually mark the parts i want to separate.

4

2 Answers 2

5

What about simply set the text in white colour for the coloured version and for the text version in black but with a wildcard of the same size as the image?

Maybe it's not elegant, but seems to work.

%http://mirrors.ctan.org/info/examples/lgc2/pstricks/tiger.eps

\documentclass{article}

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{blindtext}
\usepackage{caption}

\usepackage{etoolbox}
% it is initially set to `false' and can be set by issuing
% \booltrue{coloured} or \boolfalse{coloured}
\newbool{coloured}
%comment for text version; comment out for coloured version
\booltrue{coloured}

 \ifbool{coloured}
    {\color{white}}
    {\color{black}}

%switch figure command
%param width
%param height
%param name of the image
%param image caption
\newcommand{\switchFigure}[4]{
\ifbool{coloured}
 {%if: (cloured) image
   \begin{figure}[htb]%
    \centering\includegraphics[width=#1, height=#2]{#3}%
   \caption{#4}%
   \end{figure}%
 }
 {% else: framed box
    \begin{figure}[htb]%
    \centering\parbox[t][#1][c]{#2}{}%
   \caption{#4}%
   \end{figure}%
 }
}

\begin{document}
 \blindtext
 \switchFigure{150pt}{150pt}{tiger}{1st caption}
 \blindtext[2]
 \switchFigure{150pt}{150pt}{tiger}{2nd caption}
 \blindtext
\end{document}

To switch between the version comment / comment out the boolean flag.

2
  • Nice one! Now, I think on draft mode \includegraphics already replaces the image with a corresponding box of the same size. Maybe looking at its code one could figure out how to put there an empty box instead? This will be better as it won't force you to always supply the width and height of the image. May 15, 2013 at 9:11
  • 1
    Good idea. Unfortunately the demo option of the graphicx package print a 150pt x 100pt black rectangle. You will need to redefine it like discussed here tex.stackexchange.com/questions/44195/… and here tex.stackexchange.com/questions/30622/…. May 15, 2013 at 9:32
1

I had to do a similar thing some years ago, and (ahem) somewhat over-engineered it.

You might want to take a look at my supplements package, which is intended to allow single- or multi-page sections within a document to be LaTeXed separately, while keeping counters, references, and so on, synchronised.

The idea is that if a sequence of pages have to be LaTeXed in a particular way – perhaps they have odd margins, or weird fonts, or have to have some PDF post-processing – then rather than fight with LaTeX to contain those changes to one part of the document, this lets you prepare those supplementary pages in a completely separate process, but with the page numbers (and so on) in the master file skipping the right number, so that the supplementary pages can be inserted at collation time.

This was a while ago (the package documentation reports that it should be portable to LaTeX2e!), but I expect it will still work. I've never had the motivation to update it, but if you do try this, and it works (or doesn't) please do let me know, and that might be the prompt for me to tidy this up and put it on CTAN.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .