Consider the following example. (The code is not my own.)
Code
\documentclass{article}
\usepackage{mathtools}
\usepackage{siunitx}
% Subscript text directly in math mode.
\makeatletter
\begingroup
\catcode`\_=\active
\protected\gdef_{\@ifnextchar|\subtextup\sb}
\endgroup
\def\subtextup|#1|{\sb{\textup{#1}}}
\AtBeginDocument{\catcode`\_=12 \mathcode`\_=32768 }
\makeatother
\ExplSyntaxOff
\DeclareMathOperator{\price}{price}
\DeclareSIUnit\kroner{kr.}
\begin{document}
\begin{align*}
\MoveEqLeft \price_|total| - \price_|Water park, total|\\
&= 7 \cdot \price_|hotel, total| + 14 \cdot \price_|adult|(\text{food}) + 14 \cdot \price_|child|(\text{food})\\
&\hphantom{{}=} - \price_|Water park, total|\\
&= \SI{2069.00}{\kroner} - \price_|Water park, total|.
\end{align*}
\end{document}
Output
Questions
(a) In the second line there is missing a space between the first +
and 14
. How do I fix this?
(b) In the last line is there too much space between the subscript total
and the .
? If there is, how do I fix this?
Update
Another question: Is it a difference whether or not there is a blank space between 32768
and }
in the code?
I haven't been abel to defect any differences myself when making a few examples.