I regularly have to typeset equations that are, because of their inherent complexity, difficult to read. To address this I have gotten into the habit of emphasizing operator precedence by horizontal spacing.
To give a simple example, because in mathematics \times
binds stronger than +
, and +
binds stronger than =
, I would do things like this:
\[ a \times b \; + \; c \times d \;\; = \;\; (e + f) \times g \]
I've found that this immediately makes it easier to understand an equation at a glance.
Well, since then I have devised a way that is a little nicer than that, defining a family of custom 'math ligatures' using the semantic
package:
\[ a `*` b ``+`` c `*` d ```=``` (e + f) `*` g \]
Increasing the number of backticks exponentially increases the extra space, and I've experimentally come up with lengths that appear most pleasing to the eye. The implementation comes down to the following (though I have left out a number of corner cases and features, such as encoding \times
as `*`
):
\RequirePackage [ligature] {semantic}
\mathlig{`````}{\mspace{38mu}}
\mathlig{````}{\mspace{23mu}}
\mathlig{```}{\mspace{12mu}}
\mathlig{``}{\mspace{5mu}}
Have other people already attempted something similar? Is there a way to do this better / easier / automatically?
On a more philosophical note (and I hope this doesn't violate the spirit of stackexchange; mods, please let me know if I should remove this), I somehow expect this to be a controversial approach. After all, many die-hard TeX users go through great lengths to preserve the beautiful spacing that TeX generates. I would actually like to hear from you. How do you solve the problem of formula readability?
makefile
have always bothered me. How about extra pairs of parentheses when they're helpful? – Ethan Bolker Jun 30 '13 at 17:09\medmuskip
or similar parameters in the same formula: TeX uses the value that's current at the end of the formula. If your scope is limited to the four symbols\times
,+
,-
and=
one can probably do it without resorting to such markup. – egreg Jun 30 '13 at 20:03