New bye here, I have a situation to solve, with two different behaviors of the tilde. The first looks normal, within a regular text, something like:
... some text $\sim$A then some text ...
but in equation mode (or even inside the equation dollar signs within the text), there is a space between the tilde and the letter (see the screenshot below):
... some text $\sim{A}$ then some text ...
Is there a way to eliminate that space, in equation mode?
I need it for equations mode:
\[ \sim{A} = ... \]
If relevant, in the preamble I use the package lmodern
to use the CM10 font., plus some others dealing with equations: mathptmx, amssymb, amsmath, mathspec
and parse the text with xelatex.
Best Answer
The default "math type" of
\sim
ismathrel
, i.e., that of a relational operator. (Another example of an operator of typemathrel
is=
.) The default math type of the letterA
ismathord
("math ordinary"). As you've "discovered", TeX automatically inserts some whitespace -- in the amount of\thickmuskip
-- between elements of typesmathrel
andmathord
, respectively.If you do not wish to get whitespace between
\sim
andA
, simply writeThis setup changes the math type of
\sim
tomathord
, and TeX does not insert extra whitespace between elements of typemathord
.