[Tex/LaTex] Two spaces in LaTeX code

sourcecodespacing

I have a simple question: does it make any difference whether at some point I have two spaces instead of one in the source code, say after a period? That is, will PdfTeX ever output different things with two codes that, everything else being equal, differ in this:

end of. Sentence

vs.

end of.  Sentence

I am not asking about the difference between having \frenchspacing or not, I am really just interested in how multiple spaces in the source code are interpreted.

Best Answer

No. Multiple consecutive spaces are gobbled into a single space within the code, unless they are hard coded (like using ~ or \ - a control space - or via \hspace, or ...).

The setting of it might differ, however, depending on the other elements within the line of text. This is because the inter-word spacing can shrink/stretch as the paragraph setting is optimised. Here are some examples that hopefully illustrates this:

enter image description here

\documentclass{article}

\begin{document}

% Same end-of-sentence/period
This is text. Some more text.

This is text.  Some more text.

This is text.                    Some more text.

\hrulefill

% Regular space
This is text.\ Some more text.

This is text.~Some more text.

\hrulefill

\medskip

% Stretched inter-word space
\parbox{120pt}{This is text. Some more text.}

\medskip

\parbox{120pt}{This is text.\ Some more text.}

\end{document}