Using ~
or \⍽
(control space, just in order to make it clear) in math mode is not equivalent, as the following example shows:
\documentclass{article}
\begin{document}
$a=\ =b$
$a=~=b$
\end{document}
This produces

Why is that? Because the definition of ~
is
1299 \DeclareRobustCommand{\nobreakspace}{%
1300 \leavevmode\nobreak\ }
1301 \catcode `\~=13
1302 \def~{\nobreakspace{}}
(line numbers are those in latex.ltx
). Thus ~
also adds a {}
group that's significant in math mode and explains the difference in output: in the first line we have (Ord stands for an atom of class “ordinary”, Rel for an atom of class “binary relation”)
Ord Rel <skip>
Rel Ord
and TeX ignores explicit skips when deciding what math spacing to insert. So by rule it inserts a thick space between Ord and Rel and between Rel and Ord, but no space between Rel and Rel. The <skip>
due to \⍽
is inserted back when converting the math list to a horizontal box.
In the second case we have
Ord Rel <skip>
Ord Rel Ord
because in math mode {}
counts as an Ord atom. Thick spaces will be inserted at either side of the empty Ord atom.
Thus it's better to use \⍽
instead of ~
, in order to avoid surprises. However, the usage should be limited to separating parts of a formula that need to be considered as words, typically in displays. There's no difference between
\[
\sin\pi = 0\ \text{and}\ \cos\pi = -1
\]
and
\[
\sin\pi = 0 \text{ and } \cos\pi = -1
\]
Just a question of personal preference, because either will use the interword space relative to the current font outside of math, without stretching or shrinking. For spacing math symbols the best is to use \mkern
or \mskip
(possibly the latter, for which amsmath
provides the \mspace
interface, analog to \hspace
).
Note that in inline math mode \⍽\text{and}\⍽
and \text{⍽and⍽}
are different, as the former inserts spaces that may participate to stretching and shrinking, whereas the latter inserts “frozen” spaces. However, something like
the set $N_n(R)=\{\,x\in R: x^{n-1}\ne 0\ \text{and}\ x^{n}=0\,\}$
is more properly written as
the set $N_n(R)=\{\,x\in R: x^{n-1}\ne 0$ and~$x^{n}=0\,\}$
so as to give TeX more chances to properly break the line.
The ending-period stems from the fact that you're including it in the counter representations
\renewcommand{\thesection}{\Roman{section}.}
\renewcommand{\thesubsection}{\Alph{subsection}.}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}.}
since \thesection
(and friends) are used as-is for writing the references when using \label
. Instead, you should change \@seccntformat
for adding an ending-period in all sectional headings:
\makeatletter
\renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
\makeatother
The above definitions of \the...
still seems strange as they are not hierarchical. Typically \thesubsubsection
would include a reference to \thesubsection
, and similarly \thesubsection
would include a reference to \thesection
. My suggestion would therefore be to use
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\thesection.\Alph{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
However, the choice is eventually yours.
Best Answer
The tilde
~
is an unbreakable space, i.e. the line will never be broken at this position. If you writeTable~\ref{...}
the table number generated by\ref
will always be on the same line asTable
, which is the preferable formatting. Having "Table" at the end of a line and then "1" at the beginning of the next simply looks bad.The tilde is also used in names if they include a title, like
Dr.~Faust
, which will also ensure that the "Dr." and the name is not broken between two lines, and also ensures that the.
is not taken as a full-stop, which usually produces a larger space after it.