# uniform spacing between words and sentences

I would like to specify a particular global setting in my thesis, so that every time I use the space tab in my keyboard, I get the exact same appearance in my latex document. As of now, that is not the case. I see marked discrepancies in the generated PDF file, even though upon checking the source .tex file I can see that the spacing is uniform. I would greatly appreciate any useful tips.

• Presumably you want a ragged margin rather than justified text? – Joseph Wright Dec 31 '14 at 10:15
• Can you please make clearer what your aim is? The vast majority of printed books use variable spaces for justifying lines (that is, making them the same width except for the last in a paragraph). If you're suffering from too wide spaces, then perhaps your template is modifying some internal parameters. Can you be more precise? – egreg Dec 31 '14 at 15:23
• Please tell us more about your document settings. Have you (or a package you load) maybe issued the directive \sloppy? Normally, TeX's tolerances for allowing variations in interword spacing are quite tight and not readily noticeable at first, or even second, glance. The fact that you mention noticing marked differences in interword spacing suggests that some of the default settings of the paragraph building algorithm have been overridden. – Mico Dec 31 '14 at 15:25

The TeX program does not really use spaces in its output. Unless told to do otherwise (e.g., \obeyspaces), it actually discards the spaces that you type when it processes your file. Then TeX puts words and sentences into boxes and stretches or shrinks the amount of "glue" between them until they form lines, paragraphs, and pages that satisfy the program's algorithms to meet a standard for a well-formed page. This is one of the primary functions of the program, but you can disable it.

If you are really serious about not having any spacing adjustments between words or sentences, then use a monospaced (typewriter) font, \frenchspacing between sentences, and \raggedright alignment.

\documentclass{article}
\usepackage{lmodern} % or any other package providing a monospaced (typewriter) font
\usepackage[T1]{fontenc}
\usepackage{lipsum} % for example dummy text

\renewcommand*{\familydefault}{\ttdefault} % set typewriter font as default
\frenchspacing % only one space between sentences
\raggedright   % do not adjust interword spacing, leave right margin uneven

\begin{document}
\lipsum
\end{document}


Another option would be just to use a typewriter! :)

• It's very good to mention this fact. 'Checking the spaces in your TeX document' is a useless endeavor. – Sean Allred Dec 31 '14 at 16:39
• Well, the typewriter is an option if you have access to an antique shoppe or museum :-) – jamesqf Dec 31 '14 at 18:34

Perhaps you mean the different spacing between word and after punctuations. This can be disabled with \frenchspacing:

\documentclass{article}

\begin{document}
abc abc. abc

\frenchspacing
abc abc. abc

\end{document}


• i don't think the question is clear on this. the op needs to say whether he also wants uniform spacing in all adjacent lines. (of course, \frenchspacing does resolve the end-of-sentence situation.) – barbara beeton Dec 31 '14 at 13:20

First off, do make sure that a directive such as \sloppy isn't enabled in the preamble of your document.

You don't mention that hyphenation should be disabled, so I'll assume that it's OK to allow hyphenation. If this assumption is correct, you could achieve your objective by loading the ragged2e package with the option document in the preamble. The document option tells the package to apply ragged-right style (while still allowing hyphenation) not only in the body of the text, but also in additonal locations such as footnotes, lists and (if present) in-margin paragraphs.

Separately, you may also want to issue the command \frenchspacing to tell TeX not to insert a bit of extra space after periods ("full stops"), question marks, and exclamation marks.

\documentclass{article}
\usepackage{lipsum}
\usepackage[document]{ragged2e}
\frenchspacing
\begin{document}
\lipsum[1-2]
\end{document}


This is a really bad idea. TeX stretches and shrinks spaces (usually only slightly) so that each line has the same length. Without this freedom, the output will look awful.

\documentclass{article}
\usepackage{lipsum}
\spaceskip=0.6em % <--- Fixes interword spacing
\raggedright % <--- Prevents hyphenation
\begin{document}
\lipsum[1-3]
\end{document}


• simply applying \raggedright usually results in uniform spacing. add \frenchspacing to have post-sentence spaces the same width as interword spaces. – barbara beeton Dec 31 '14 at 13:17
• thanks for all your valuable comments. I need sometime before I can revert with my comments. I haven't checked the specific command related to spacing in the template that I am using. I shall revert ASAP. – Vinod Jan 2 '15 at 6:35