0

I have the following main file

\documentclass{article}
\usepackage{standalone}
\usepackage{tikz}
\usepackage{apacite}
\bibliographystyle{apacite}
\begin{document}
   \begin{figure}
       \input{figures}
       \caption{test  \protect\cite{ahu61}}.
   \end{figure}
   \bibliography{test.bib}
\end{document}

depending on the file figures.tex

\documentclass{standalone}
\usepackage{tikz}

\begin{document} \begin{tikzpicture} \draw (0,0) rectangle (1,1); \end{tikzpicture} \end{document}

and the file test.bib

@article{ahu61,
   author={Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa},
   title={Constraint qualifications in maximization problems},
   journal={Naval Research Logistics Quarterly},
   volume={8},
   year=1961,
   pages={175-191}
}

When I compile the file main file I get the following error

Can be used only in preamble. \caption{test \protect\cite{ahu61}}

When I write instead {\input{figures}} or remove the line with \input{figures} completely the file compiles without any error. Why does this happen?

BlaBla
  • 1
  • @user202729 that is true. Thanks for the hint. I will update the question – BlaBla Apr 22 '22 at 16:04
  • @TomMa I don't think so. In the standalone manual (https://mirror.clientvps.com/CTAN/macros/latex/contrib/standalone/standalone.pdf) it is written in the page 5 "When the sub-file is compiled on its own the \documentclass and document environment will be active as normal. The main file, however, will skip every- thing from the \documentclass till the \begin{document}. The (now fake) document environment is redefined to be a simple TeX-group. Any code lines after the \end{document} will be ignored. The real document environment of the main file will be unaffected and will work as normal." – BlaBla Apr 22 '22 at 16:19
  • Okay it's a conflict/bug between standalone package and apacite package. – user202729 Apr 22 '22 at 16:37
  • Yes, @BlaBla. You are right. I was wrong. It do cause by the conflict between standalone package and apacite package. – Tom Apr 22 '22 at 17:36

0 Answers0