3

I am combining a set of articles using the combine document class. However, use of the \newtheorem command in the individual articles causes an error, when these environments have already been defined by an earlier paper. I would like to maintain the ability to compile each file individually, which precludes simply deleting or commenting out these \newtheorem commands. The combine class seems preferable to the standalone class, which apparently simply ignores the entire preamble; this would eliminate the title and author information from each paper, as well as any \newcommands each author may have defined.

For example, a main file:

\documentclass{combine}
\usepackage{amsthm}

\begin{document}
\begin{papers}

\coltoctitle{An article} \coltocauthor{A.~N.~Author} \label{art1} \import{ThmTest}

\coltoctitle{Another article} \coltocauthor{A.~N.~Author} \label{art2} \import{ThmTest2}

\end{papers}
\end{document}

together with the files ThmTest.tex and ThmTest2.tex (same contents):

\documentclass{article}
\usepackage{amsthm}

\newtheorem{Theorem}{Theorem}[section]

\begin{document}

\section{Section}

\begin{Theorem}
A theorem.
\end{Theorem}

\end{document}

The combine documentation (http://ctan.mackichan.com/macros/latex/contrib/combine/combine.pdf) suggests on p. 14 that the problem can be avoided by "cunning use of grouping." Simply adding braces around each imported article doesn't seem to fix the problem, so what kind of grouping might work?

3

The authors suggest that their solution to the \newtheorem problem is that they redefine the \newtheorem macros to be local rather than global. My guess is that by loading the amsthm package in the preamble, you have overwritten that code. In any case, removing the package from the preamble, and grouping as they suggest seems to fix the problem.

\documentclass{combine}
\begin{document}
\begin{papers}
\coltoctitle{An article} \coltocauthor{A.~N.~Author} \label{art1} \begingroup\import{ThmTest}\endgroup

\coltoctitle{Another article} \coltocauthor{A.~N.~Author} \label{art2} \begingroup\import{ThmTest2}\endgroup
\end{papers}
\end{document}
  • Great! Of all the things I tried, simply deleting all the theorem packages never occurred to me! – Annie Carter Jun 11 '13 at 15:04

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.