Due to the typographic traditions I'm used to, I prefer my \ldots
to have no spacing in between, ideally exactly the same amount as in text. In math mode I would like to write things like \(1, 2, \ldots, n\)
and have the spacing be adaptive:
- if the next character is a comma, I'd like something very thin like
\kern .08333em
(i.e., half of a\thinspace
) afterwards; - if there is an opening parenthesis ("(", "[", "{", …) before or a closing parenthesis (")", "]", "}", …) after the dots, there should be no or only tiny additional spacing (i.e., less than
\kern .08333em
); - and whatever other adaptations of space around
\ldots
or\dots
are normally produced by (La)TeX; - feel free to add other ideas.
What is the best way of redefining \ldots
for these purposes?
Best Answer
\ldots
is using\mathellipsis
for the dots. It could be redefined to use the text version, but the mixup of text and math fonts might not always a good idea.\mathellipsis
itself uses three dots as punctuation characters. That means, there is additional thin space between the dots. This can be changed by putting them into a subformula, then they are treated as\mathord
atoms without additional space.Smaller spaces
Usually thin space is the smallest space in math mode, but to some degree
\ldots
can be adopted to smaller spaces:TeX sets a thin space between inner atoms and punctuation chars in display and text style only, therefore the use of
\nonscript
. There is no space in case of the closing)
, but because of the character shape, you probably want to have a negative kerning, this is applied in all math styles.More generalized detection of a closing delimiter
The example uses Andrew's hint of
\rightdelim@
:But for the detection of an opening delimiter before I do not see a way. There isn't a "
\lastmathatom
". Manually the space correction can be applied as the example file shows with\neghalfmskip
.