3

On mathtools manual, page 27, there is an example defining a command \Set:

% just to make sure it exists
\providecommand\given{}
% can be useful to refer to this outside \Set
\newcommand\SetSymbol[1][]{%
    \nonscript\:#1\vert
    \allowbreak
    \nonscript\:
    \mathopen{}}
\DeclarePairedDelimiterX\Set[1]\{\}{%
    \renewcommand\given{\SetSymbol[\delimsize]}
    #1
}

What is this \mathopen{} for? I read the answer of this question, which involves \mathopen along with some explanations, but still don't understand it here.


Edit:

I just saw that on page 26 in a previous example there is some explanation:

enter image description here

enter image description here

Does this mean that \mathopen{} here is basically the same as \mathopen\delimsize\vert (I'm not sure if this is a valid combination)?

Jinwen
  • 8,518
  • (I was about to say "the command is documented in " before realizing the question asks for "why is this command useful in this particular command". -- assuming you already know about character classes and the spacing inserted between them?) – user202729 Jun 14 '22 at 14:57

1 Answers1

7

Some people write ]-1,1[ to denote the open interval from -1 to 1. The default TeX math status of the characters [ and ] is mathopen and mathclose, respectively. To properly typeset the open interval mentioned in the first sentence, it's a really good idea to input it as

\mathopen{]} -1 , 1 \mathclose{[}

enter image description here

Observe that if one fails to inform TeX that the ] character should be treated as having type mathopen, TeX is led to interpret the - ("minus") character as a binary instead of as a unary operator.


The term \mathopen{} inserts an empty atom of type mathopen into the input stream. This is helpful in case the material that comes after \vert starts with a unary operator such as +, -, \pm, etc. (The default math status of \vert is mathord.)


\documentclass{article}
\begin{document}
$]-1,1[$ \qquad $\mathopen{]}-1,1\mathclose{[}$
\end{document} 
Mico
  • 506,678
  • Thank you, it is good to know. In France people tend to use the notation ]-1,1[ instead of (-1,1). But this doesn't seem to answer the original question. – Jinwen Jun 14 '22 at 14:31
  • Jinwen - Thanks. I've added a paragraph to discuss the purpose of \mathopen{}. – Mico Jun 14 '22 at 14:38