I am writing a paper in LaTeX. I will need both the one-column and two-column versions of the paper. For this, the figure sizes/configurations need to be different in the two documents. I am looking for a command like \iftwocolumn
! Do you know if it exists and if not how can I define and use it?
I would need something like:
\begin{figure}[tb]
\iftwocolumn\includegraphics[width=0.7\linewidth]{FiguresDouble/figure.eps}
\else\includegraphics[width=0.5\linewidth]{FiguresSingle/figure.eps}
\fi
Best Answer
\linewidth
or\columnwidth
should work, since a non-twocolumn
document technically consists of a single column (of width\columnwidth
).However, if you're using the traditional
twocolumn
mode of (say)article
, the condition\if@twocolumn
is available for testing/branching.Here's a short example showing the difference:
Note that you require the use of a
\makeatletter
...\makeatother
pair, since the command definition of the conditional contains@
. See What do\makeatletter
and\makeatother
do?