1

I am writing a revtex document that requires some equations to be typeset differently depending on whether I am in one-column preprint or in two-column reprint mode. Is there a way to specify separate equations depending on the mode?

This is similar to this question, but the solution proposed there doesn't seem to work with revtex:

\documentclass[aip,jcp,reprint,citeautoscript,longbibliography]{revtex4-1}
\begin{document}

\makeatletter
\if@twocolumn
\newcommand{\whencolumns}[2]{
#2
}
\else
\newcommand{\whencolumns}[2]{
#1
}
\fi
\makeatother

\whencolumns{One Column}{Two Columns}
\end{document}

This generates the text "One Column" both in reprint and in preprint mode.

2

The class has

\DeclareOption{preprint}{%
 \@booleantrue\preprintsty@sw
 \ExecuteOptions{12pt}%
}
\DeclareOption{reprint}{%
 \@booleanfalse\preprintsty@sw
 \@booleantrue\twocolumn@sw
 \ExecuteOptions{10pt}%
}

So you can do

\makeatletter
\newcommand{\whencolumns}[2]{\preprintsty@sw{#1}{#2}}
\makeatother

Full example:

\documentclass[% Try both options
  preprint,
  %reprint,
]{revtex4-1}

\makeatletter
\newcommand{\whencolumns}[2]{\preprintsty@sw{#1}{#2}}
\makeatother

\begin{document}

\whencolumns{Preprint}{Reprint}

\end{document}
2

As I learned from the answer to this question it is quite easy to test if a class option is set:

\documentclass[preprint]{revtex4-1}

\makeatletter
\newif\ifpreprintoption
\@ifclasswith{revtex4-1}{preprint}{\preprintoptiontrue}{\preprintoptionfalse}
\makeatother
\newcommand{\ifpreprint}[2]{\ifpreprintoption #1\else #2\fi}

\begin{document}

\ifpreprint{Preprint}{Reprint}

\end{document}

prints "Preprint" if the preprint option is set, and "Reprint" otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.