Keeping the distance between mathematical symbols consistent?
You would have to modify the length registers that allow for stretch/shrink around math operators/relations, namely \medmuskip
and \thickmuskip
. Their defaults are 4.0mu plus 2.0mu minus 4.0mu
and 5.0mu plus 5.0mu
. So adding
\setlength{\medmuskip}{1\medmuskip}% Formerly 4.0mu plus 2.0mu minus 4.0mu -> 4.0mu
\setlength{\thickmuskip}{1\thickmuskip}% Formerly 5.0mu plus 5.0mu -> 5.0mu
should work by stripping the glue. For more on math spacing around operators, see How to change default for spacing around binary relations?
Here's a small example:
\documentclass{article}
\begin{document}
Here is some text with an equation in it: $f(x)=x^2+3x_0\cdot\sin x$
and the textual content continues into the second line. No other math
content is contained within this paragraph.
%\thinmuskip=3.0mu (without glue)
\setlength{\medmuskip}{1\medmuskip}% Formerly 4.0mu plus 2.0mu minus 4.0mu -> 4.0mu
\setlength{\thickmuskip}{1\thickmuskip}% Formerly 5.0mu plus 5.0mu -> 5.0mu
Here is some text with an equation in it: $f(x)=x^2+3x_0\cdot\sin x$
and the textual content continues into the second line. No other math
content is contained within this paragraph.
\end{document}
Since \thinmuskip
is already void of glue, no further modifications is required. For a motivation of where these lengths are used, see the mathmode
documentation (section 11 Space, subsection 11.1 Math typesetting, p 28).
mu
skips are not supported by calc
, alternate calculations techniques (using plain TeX) are required to manipulate these lengths.
As an alternative to resetting the parameters it is sometimes more convenient to box the expression so it is set to natural width, either with an explicit box, or within the math, just using {}
.
Note the math only stretched on the second row in this plain tex example.
X\hbox{words here $a + b$ and here}X
X\hbox spread 1cm{words here $a + b$ and here}X
X\hbox spread 1cm{words here \hbox{$a + b$} and here}X
X\hbox spread 1cm{words here ${a + b}$ and here}X
\bye