Skip to main content

The PreTeXt Guide

Section 4.10 Mathematics Best Practices

This section addresses some finer points of authoring mathematics with , motivated in large part by helping MathJax create the most accessible output possible, which in many instances will also create a superior typographical result across all conversions. We try to provide justification and explanation, though that might not be easy in all cases. Some are definitely technical, and we are only aware of them from authors’ experience and reports. Many are meant to help in the conversion to braille. This is an incomplete list so additional reports and additions are welcome.

Large Numbers.

Using a separator to aid in reading a large number should avoid using a space as a separator. So \(234{,}766{,}544\) or \(234.766.544\) is preferable to \(234\,766\,544\text{.}\) We have used braces around the commas in the first instance, and a “thin space”, \, , in the last instance.) For \(234{,}766{,}544\text{,}\) braces around each comma prevents automatic trailing space that would normally be desirable in a list of numbers. In other words, author as:
<m>234{,}766{,}544</m>
Here is the version with commas and no effort to distinguish the big number from a list of smaller numbers: \(234,766,544\text{.}\)

Ratios.

If you really intend to communicate a ratio with a colon, keep it super-simple, like 3:2 or a:b. Do not wrap it in parentheses or other decorations, since then the colon will be communicated literally in braille. For example, the index of a subgroup, [G:H], will not be confused with a ratio, due to the brackets. But (4:5) will not be output in a conversion to braille in a way that communicates that it is a ratio. If you keep your ratios simple, braille output will use special syntax designed for ratios.

Function and Operator Names.

Common mathematical functions, like \(\sin\) (\sin) and \(\det\) (\det), are built into , well-known, and commonly used. Compare with the versions authored as simple sequences of letters \(sin\) and \(det\text{,}\) which interprets (and typesets) as a product of three individual variables.
Instead, use the \DeclareMathOperator macro as we will illustrate. Suppose you want to discuss the set of homomorphisms from the vector space \(U\) to the vector space \(V\text{,}\) \(\Hom{U}{V}\text{.}\) Define the macros
\DeclareMathOperator{\homop}{Hom}
\newcommand{\Hom}[2]{\homop\left(#1,\,#2\right)}
and employ as \Hom{U}{V}, which yields \(\Hom{U}{V}\text{.}\) Compare with the no-macro, no-special-care, version, \(Hom(U,V)\text{.}\) Grouping Hom as a unit will prevent from rendering it as a product of three variables, use the correct font, and will preserve the meaning in Nemeth braille. Notice that the \homop macro is never used in your source.
Directly contradicting this general advice, Sean Fitzpatrick reports on 2021-01-06 that the macro construction
\newcommand{\foo}{\operatorname{foo}}
behaves better in Asymptote diagrams than
\DeclareMathOperator{\foo}{foo}
So perhaps you need to define a second macro for use in Asymptote diagrams.

Permutations in Cycle Notation.

The permutation in cycle notation, \((1246)(35)\text{,}\) is difficult to distinguish from a product of two integers and gets entirely different treatment than intended as Nemeth braille. And when the points of the permutation group involve multiple digits, some other notation will become necessary anyway. Commas work, as in \((1,2,4,6)(3,5)\text{.}\) Or if commas look too cluttered, then spaces are possible, as in \((1\;2\;4\;6)(3\;5)\text{,}\) where we have used the medium space, \; .

Text in Math.

We have discussed this one already, but it is important for a conversion to braille. If you use a word inside of math, such as describing a condition for membership in a set, put any spaces inside of a \text{} macro, not on either side of it. So \text{ and } is preferable to \ \text{and}\ . Similarly, do not put any math inside a \text{} macro. For example,
\text{ for -3 \lt  x \lt  -2 }
will lead to poor results due to the inequalties mixed in with the text. A better version would be
\text{ for }-3 \lt  x \lt  -2
and now the numbers will be treated as mathematics. Review Subsection 4.9.5 for more details.

Math as Text.

Do not use symbols from mathematics in non-mathematical situations such as the construction 73^\circ to indicate a temperature in degrees, outside of a mathematical or scientific setting, such as in a <poem> about springtime weather. In this particular case, we provide a <degree/> element that can be used in non-mathematical contexts, so we can get 73°, which will behave well in a variety of conversions (and can also be used for latitude and longitude in your poem). Similarly, we advocate writing ordinal numbers with text on the baseline, rather than a construction like 2^\mathrm{nd}. So use 1st, 2nd, 3rd, 4th, etc.

Avoid Nesting.

It may seem convenient to nest custom macro definitions. For example:
\newcommand{\makered}[1]{{\color{red}{#1}}}
\newcommand{\MAKERED}[1]{\textbf{\makered{#1}}}
The second macro definition uses the first macro. At least one PreTeXt conversion isolates macro defintions for use only on an as-needed basis. So here, if the author used \MAKERED without also using \makered close nearby, it would lead to an issue under that conversion, because \makered would be locally undefined. So we recommend defining each macro from the ground up. In this case:
\newcommand{\MAKERED}[1]{\textbf{\color{red}{#1}}}
This also contradicts our advice above on operator names.