I have a document that I need to manage multiple versions of, for multiple languages. So far I've kept a different LaTeX project for each, but it's a bit annoying to have to open, edit and save multiple projects every time. I want to be able to "label" parts of the document, and have only the corresponding labeled parts show in the PDF file depending on which "version" option is selected.
The text is interspersed through the document, so keeping different tex files and including them conditionally does not work. Would also prefer not to change the document class.
The best option I've found was to declare an environment to surround the blocks of text with a comment declaration, like so:
\usepackage{verbatim}
\newenvironment{v1}{}{} % to show
% \newenvironment{v1}{\comment}{\endcomment} % to hide
(...)
\begin{v1}
(...)
\end{v1}
Well, \comment
and \endcomment
just straight up don't work, even when directly included in the text I get a fatal error from Overleaf. I also tried importing comment
instead of verbatim
, with the same results.
\begin{comment}
and \end{comment}
generally (not always) work when directly included in the text, but also throw a fatal error when used in the environment declaration (as in \newenvironment{v1}{\begin{comment}}{\end{comment}}
).
The errors I get vary depending on what exactly I try to comment out. I always get a LaTeX3 Error: Command '\FA' already defined!
error stemming from one of the template files (it's not being edited), and complaints about runaway arguments or missing }
(which I've checked and don't seem to actually exist).
What would be the correct way to utilize \begin{comment}
and \end{comment}
in the environment declaration? Is there another way to achieve a similar end?