Generalhow to manage LaTeX macros in a collaborative paper

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
yoo
Posts: 5
Joined: Sun Nov 08, 2009 2:38 pm

how to manage LaTeX macros in a collaborative paper

Post by yoo »

Let's say X and Y are writing a single paper, and say X writes part 1 and Y writes part 2. Each of these authors has their own tex file containing all of their macros (\newcommand stuff)

X and Y add include their macros together in the preamble:

Code: Select all

% preamble
% ...
\input{X-macros.tex} % X's macros
\input{Y-macros.tex} % Y's macros
% ...
\begin{document}
\include{part1.tex}
\include{part2.tex}
\end{document}
And it turns out that X and Y share a lot of macro names, sometimes same name with different definitions.

How should we deal with such macro conflict issues?

Is there a way to introduce some kind of namespace or scope?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

how to manage LaTeX macros in a collaborative paper

Post by nlct »

You could do something like:

Code: Select all

\begin{document}
{\input{X-macros.tex}% X's macros
\include{part1.tex}}
{\input{Y-macros.tex}% Y's macros
\include{part2.tex}}
\end{document}
Regards
Nicola Talbot
Post Reply