0

I was curious to figure out what the purpose of using "~" operator in Latex is. I noticed the following piece of code which stated:

Figure~\ref{fig:x}

However, if you had to, for example, write the following segment:

Figure \ref{fig:x}

the exact same output is obtained.

  • 3
    The ~ generates a non-breaking space. – campa May 12 '21 at 10:44
  • Often also called a tie as it ties together the front and back using a space that cannot be used in line breaking – daleif May 12 '21 at 11:08
  • Beyond its typical use as a nonbreaking space, the fact that ~ is an "active" character allows its use in all sorts of other "temporary" ways. One of my favorites is its use in the temporarily revised definition of \texttt at https://tex.stackexchange.com/questions/472416/enable-highlighting-and-auto-line-breaking-for-texttt/472431#472431. Another is to use ~, temporarily redefined to some macro, to execute that macro during such temporary moments when the category code of the backslash has been changed to 12, as in the case of setting up verbatim text. – Steven B. Segletes May 12 '21 at 11:10
  • This is not LaTeX specific. The acitve ~ defined as \nobreak\ was introduced in plain TeX. – wipet May 12 '21 at 11:21

0 Answers0