[OS X TeX] Test whether an option has loaded

Chris Goedde cgg.lists at gmail.com
Fri Mar 2 04:46:21 CET 2012


On Mar 1, 2012, at 8:48 PM, David Craig wrote:

> How does one test whether a particular documentclass option has been loaded?  
> 
> My specific objective is to typeset certain sections of code differently depending on whether or not the document is being set in "preprint" mode or not in revtex4.

You can do it using the version package:

\documentclass[aps,prd,%
preprint,%
]{revtex4}

\usepackage{version,xstring}

\makeatletter%
\IfSubStr{\@classoptionslist}{preprint}%
{\includeversion{ppversion}\excludeversion{finalversion}}%
{\includeversion{finalversion}\excludeversion{ppversion}}%
\makeatother%

\begin{document}

\begin{ppversion}

This is the preprint version.

\end{ppversion}

\begin{finalversion}

This is the final version.

\end{finalversion}

\end{document}


More information about the macostex-archives mailing list