I am not facing any problem, but I need the opinion of the community.
I am writing a thesis and have a lot of tikz figures in it. So what I do is pre-compile these tikz files to PDF and then include them in the thesis. This makes the re-compiling of the thesis faster as no longer I have to compile the tikz files again and again, when I do minor modification in the text.
I have written a macro to include graphics like this -
\newcommand\myIncludeGraphics[2]{
\ifdefined\embedTikzGraphics
\scalebox{#1}{\input{#2.tikz}}
\else
\includegraphics[scale=#1]{#2}
\fi
}
and I include the graphics like this -
\begin{figure}
\myIncludeGraphics{0.9}{chapters/chap1/Figures/fig1}
\end{figure}
Here 0.9 specifies how much to scale the figure. However, sometimes I would like to place two figures side-by-side and then I need to manually calculate the scaling factor.
\subfloat[CAP1]{\label{fig:lab1a}{\resizebox{0.5\columnwidth}{!}{\includegraphics{chapters/chap1/Figures/fig1a}}}}
\subfloat[CAP2]{\label{fig:lab1b}{\resizebox{0.5\columnwidth}{!}{\includegraphics{chapters/chap1/Figures/fig1b}}}}
This will help me to fit the two figure exactly to column-width of the document. However, I lost the capability of embedded tikz files.
I want some suggestions if I can cover all three scenarios in one macro keeping the code clean. I should be able to use scaling factor or width=\columnwidth.
If this is not possible, it is fine. Please excuse, if I didn't define the problem correctly.
Thank You
UPDATE
Just to summarize what I am trying to achieve is the following.
- I should be able to use the tikz picture integrated in the main pdf or tikz picture which is compile separately and then included in pdf using includegraphics.
- When using includegraphics, I should be able to specify either
widthof the figure orscale factorof the figure. - When using the tikz picture integrated in main pdf, I will not change the macro in my tex. For example the macro usage will look like
myIncludeGraphics{scalefactor=0.9}{chapters/chap1/Figures/fig1}ormyIncludeGraphics{figWidth=0.5\columnwidth}{chapters/chap1/Figures/fig1}. Depending on the first argument, the macro should usescaleboxorresizebox. This is becausescaleboxdoes not understand0.5\columnwidthand the other way round for theresizebox.

\usetikzlibrary{external}\tikzexternalize)? See the TikZ manual, section "50 Externalization Library". – Heiko Oberdiek Jun 19 '14 at 18:47externalize. – knowledge_seeker Jun 20 '14 at 08:32same macroeither scalefactor or width of the image. – knowledge_seeker Jun 20 '14 at 08:40scaleand if you want to use, e.g.,width, you need one of those “tricks” I linked. And, finally, if you want to be able to call both of them, it's just a little hack to tell LaTeX wether to usescaleor those systems to resize to a fixed length. – Manuel Jun 20 '14 at 08:43myIncludeGraphicsfor many tikz pictures in my thesis. Some of them require scaling, some of them require a fixed width size. I didn't much care about font size as you mentioned. Thank you for your reply. – knowledge_seeker Jun 20 '14 at 08:45