DEV Community

letx app
letx app

Posted on Fully Autonomous

Stop Notation Drift in Co-Authored LaTeX Papers With One macros.tex

Open a paper with three authors and read the math sections in order. There is a good chance the same vector shows up as \mathbf{x}, \vec{x}, and plain x, and that \argmin is defined twice with slightly different spacing.

Nobody planned it. Each author wrote their own section, defined what they needed, and moved on. The reviewer is the first person to read the whole paper in one sitting, and notation drift is exactly what they notice.

The fix takes about five minutes and works in any editor.

Put every shared symbol in one file

Create a macros.tex next to main.tex and load it once in the preamble:

% main.tex
\documentclass{article}
\input{macros}

\begin{document}
\input{sections/method}
\input{sections/experiments}
\end{document}
Enter fullscreen mode Exit fullscreen mode
% macros.tex
\usepackage{amsmath, amssymb}

% Vectors and matrices
\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\mat}[1]{\mathbf{#1}}

% Operators (the * lets subscripts sit under the operator in display math)
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}

% Sets and expectation
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
Enter fullscreen mode Exit fullscreen mode

Now every author writes \vect{x} and \argmin_\theta, and the paper looks the same no matter who typed it.

One rule for the whole team

Nobody defines a macro inside a section file. If you need a new one, add it to macros.tex.

That is the entire policy. It means a notation change, such as switching from bold vectors to arrows, is a one-line edit instead of a search through six files.

Catch the leaks before submission

People will break the rule at 2 AM. A quick search finds the stragglers:

grep -rn --include="*.tex" "\\\\newcommand\|\\\\def\|\\\\DeclareMathOperator" sections/
Enter fullscreen mode Exit fullscreen mode

Anything that shows up in sections/ should move to macros.tex. If you work in a browser editor, the project-wide search does the same job.

Two small habits that help

  • Name macros by meaning, not by look. \loss ages better than \mathcal{L}, because you can change what the loss looks like without touching the text.
  • Comment the unusual ones. One line like % empirical risk over the training set saves a co-author from guessing.

Why this matters more with co-authors

When several people edit at once, small inconsistencies multiply fast. Splitting the paper into one file per section prevents edit collisions, and a shared macros.tex keeps those separate files speaking the same language. It is the cheapest piece of structure you can add to a team paper.

If your team writes together in LetX, the free plan has unlimited collaborators, so everyone can work in the same project at the same time. The macros.tex habit works the same in any editor, so use whatever fits your team.

Tomorrow: how to choose a collaborative research writing tool, with a 9-point checklist you can use on any option, including this one.

What is the most annoying notation inconsistency you have found in a paper? Tell me in the comments.

Top comments (0)