0

I'm using the standalone package to create a document. The main document is

\documentclass{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

\begin{document}
\section{Section 1}
\import{Sections/}{Section1}
\section{Section 2}
\import{Sections/}{Section2}
\end{document}

Now within the .tex files Section1 and Section2 I have defined a new command

\newcommand{\br}{\mathbb{R}}

Which is required by both for standalone compilation, however when I try to compile main.tex this produces the error Command \br already defined. What is the best way for me to include new commands so that everything compiles correctly?

  • 2
    Define the command conditionally in each subfile and then define it in your main file. Or use \providecommand... rather than \newcommand.... – cfr Mar 25 '15 at 22:52
  • Or use subpreabbles=true on only the first file. – John Kormylo Mar 25 '15 at 23:20

Your Answer

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

Browse other questions tagged or ask your own question.