Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When using some other editors, when you type two spaces with your space bar, two spaces are effectively displayed. This is not the case in LaTeX (btw, that's not the case on these websites ;) ).

My question is barely simple I guess, but I didn't found some information about it on Google.

How to display two consecutive spaces in LaTeX (I mean two spaces horizontally, with the space bar).

share|improve this question
7  
What are you actually trying to achieve in your document? Since all good typesetting programs adjust word spacing to best fit the justification of the text, the concept of a "space" doesn't really exist. If you need to format code or something, then there are better ways to this this. –  Alan Munn Jan 1 '13 at 18:17
5  
Adding two consecutive spaces after an end-of-sentence period is nowadays considered old fashioned (see e.g. Bringhurst's Elements of Typographic Style). If I understand correctly, word users have to add the spaces explicitly, which is prone to errors. LaTeX can add them automatically: just put \nonfrenchspacing in your preamble (this is the default). However, if you want a modern look of your document, just put \frenchspacing in your document preamble. This is what I recommend in LaTeX and Friends. –  Marc van Dongen Jan 1 '13 at 19:43
    
@AlanMunn There are differences in spacing if \frenchspacing is disabled. –  Marc van Dongen Jan 1 '13 at 19:45
3  
As explained by Marc van Dongen, \frenchspacing controls the amount of space added by TeX/LaTeX after a sentence independent from the number of spaces in the source code. However, putting two spaces in the source code can still be useful, as editors like Vi and Vim use them to provide navigation like "move to the end of the current sentence". –  Christian Lindig Jan 1 '13 at 20:04

1 Answer 1

up vote 18 down vote accepted
\documentclass[12pt]{article}
\usepackage{libertine}
\begin{document}
\noindent
Firstword\space             Secondword\\    
Firstword\space\space       Secondword\\
Firstword\space\space\space Secondword

% the space between words is \fontdimen2\font

\def\HS{\hspace{\fontdimen2\font}}\the\fontdimen2\font

\noindent
Firstword\HS       Secondword\\    
Firstword\HS\HS    Secondword\\
Firstword\HS\HS\HS Secondword

\fontdimen2\font = 5\fontdimen2\font\the\fontdimen2\font

\noindent
Firstword\HS       Secondword\\    
Firstword\HS\HS    Secondword\\
Firstword\HS\HS\HS Secondword
\end{document}

enter image description here

share|improve this answer
    
thanks for sharing. –  Nicholas Hamilton Jan 2 '13 at 1:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.