Graphics, Figures & TablesConditional Compilation of Figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sgsawant
Posts: 17
Joined: Thu Jun 09, 2011 7:49 pm

Conditional Compilation of Figures

Post by sgsawant »

I have figures in the paper that I am writing. Compiling the .tex file to a .pdf with figures takes time and I wanted to reduce that by conditionally compiling the figures. That is, I wanted to compile the figures after I was done with writing the text, but I still want the code to include the figures to be in its place. Is there a simple way? I tried google but couldn't understand most of the links.

-sgsawant
Last edited by sgsawant on Mon Oct 10, 2011 12:55 am, edited 3 times in total.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Conditional Compilation of Figures

Post by localghost »

First of all you should clarify whether you are including external image files or drawing your figures with graphics packages like pgf/tikZ or PSTricks (or others).


Thorsten
sgsawant
Posts: 17
Joined: Thu Jun 09, 2011 7:49 pm

Re: Conditional Compilation of Figures

Post by sgsawant »

Yeah, sorry about that. I am including external image files from the adjacent folder. Say for example fig1.png.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Conditional Compilation of Figures

Post by localghost »

Then simply set the »draft« option either globally for the document class or only for the graphicx package. This will replace the images with boxes of the same size which contain the path and name of the included file.
sgsawant
Posts: 17
Joined: Thu Jun 09, 2011 7:49 pm

Re: Conditional Compilation of Figures

Post by sgsawant »

Thanks! :D

I am editing this reply because I have one more question - how to compile just a single figure, while the graphicx package has been set to the "draft" option? Is there a way?

-sgsawant
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Conditional Compilation of Figures

Post by localghost »

You can give the »draft« option also locally to the \includegraphics command to exclude certain images.

Code: Select all

\includegraphics[draft,scale=0.5]{filename}
It goes without saying that you now have to drop the option for the document class or the package, respectively.
sgsawant
Posts: 17
Joined: Thu Jun 09, 2011 7:49 pm

Conditional Compilation of Figures

Post by sgsawant »

Thanks a lot mate! :D

... though I wish there was an option for a local inclusion of the keyword final. :roll:

Code: Select all

\includegraphics[final,width=8cm]{fig1.png}
Post Reply