I noticed this symbol in an example. Including or excluding this from the source doesn't change anything. However, if I include \~
, it puts a ~ on the first letter of the next word. So, what could be purpose of including ~
in the code? Also, how do I print the ~ only in my document?
1 Answer
As stated in the comments, ~
inserts a non-breaking space. This means that you tell the typesetting algorithm that it should not insert a linebreak here. This is useful when making references. For example, if you write
according to the Pythagorean theorem there is a lot to be learned
form a triangle. You might see in equation \eqref{eq:1} there is
some need for
is typeset as
however,
according to the Pythagorean theorem there is a lot to be learned
form a triangle. You might see in equation~\eqref{eq:1} there is
some need for
will ensure that equation
and (1)
stay on the same line.
one two
but it won't betweenone~two
. The latter will stay in the same line together.