In this blog entry I will showcase semantic abbreviations and semantic linebreaks. These two techniques have made my LaTeX source code easy to read and edit. Keep in mind this is from the point-of-view of a mathematician, but I also use semantic linebreaks in my blog posts.
Abbreviations
To write the set of real numbers in blackboard font
one writes \mathbb{R},
or \mathbb R,
if feeling spicy.
It is common to define an abbreviation
as \R,
which is completely harmless.
But a problem arises if you keep tacking on singe letter abbreviations.
For example \N,\Q,\C,\D,\T,\H
being the naturals, rationals, complex numbers,
unit disk, unit circle, and a Hilbert space, respectively.
To me it is much clearer to read
\naturals,\rationals,\reals,\plane,\disk,\torus,\Hilbert,
where the command \plane refers to the complex plane,
\complexes is another alternative.
A minor issue with the short abbreviation approach
is command collision.
Double acute accent such as in Szegő
is performed in plain TeX as \H{o}.
I also like to give rename commands to convey semantics.
For example, the partial derivative symbol \partial
is used also as the boundary of a set.
For situations like these
I like to make a new command
\newcommand{\boundary}{\partial}.
This makes the source clearer,
compare \boundary{X}
to \partial{X}.
The first option conveys the actual meaning.
Why even abbreviate in the first place?
As seen above, it makes the source more clear.
Even in simple cases,
\reals is arguably more readable than \mathbb{R}.
More importantly,
if there is any possibility that you may change notation,
then an abbreviation makes this adjustment trivial,
just replace the definition.
Linebreaks
Semantic linebreaks makes your source code read like poetry, it is also easier to find the relevant lines to edit. To compare, here are the first few sentences of the abstract in my latest paper; formatted in two different ways, wrapping lines after 70 characters, and semantic linebreaks.
We study a subset of the analytic selfmaps of the (unit) polydisk $\disk^d$
that induce a bounded composition operator on the Hardy space $H^2(\disk^d)$.
Specifically, letting $s(z,w) = \prod_{j=1}^d\frac1{1-z_j\conj w_j}$ denote the
Szeg\H{o} kernel and letting $\phi:\disk^d\to\disk^d$ be an analytic selfmap, we
consider the condition that $\frac{s}{s\circ\phi}$ is a reproducing kernel. The
set of these we call the \emph{composition factors} of $s$.
We study a subset of the analytic selfmaps
of the (unit) polydisk $\disk^d$
that induce a bounded composition operator
on the Hardy space $H^2(\disk^d)$.
Specifically,
letting $s(z,w) = \prod_{j=1}^d\frac1{1-z_j\conj w_j}$
denote the Szeg\H{o} kernel
and letting $\phi:\disk^d\to\disk^d$
be an analytic selfmap,
we consider the condition
that $\frac{s}{s\circ\phi}$ is a reproducing kernel.
The set of these we call
the \emph{composition factors} of $s$.
Admittedly, I can read the wrapped snippet faster. However, I already have access to some even nicer typeset text via the compiled output. That said, I read the snippet using semantic linebreaks more carefully. In my opinion, the main reason to use semantic linebreaks is that the text stays put when editing. Removing entire sentences does not perturb the structure of the source code; throughout the course of a longer project this helps navigation a lot.
For more about semantic linebreaks, see sembr and asciidoctor.