8

I have a very simple question.

Sometimes I need to put two spaces between letters or words, like this:

a a    %this is a single space
a  a   %this is a double space

I want the double space to be as if was a single space*2. What is the simplest way to achieve this?

Currently what I'm doing is

a\ \ a

but I'm under the impression this is not a clean way to achieve my goal

  • 1
    I don't know of a better way (may be ~~ if you don't want them to break), but why do you need that? – Manuel Dec 05 '13 at 21:12
  • 4
    Either ~~, or call \obeyspaces inside a group and you don't have to worry about forcing it. – Werner Dec 05 '13 at 21:13
  • 2
    In the TeXbook source, Knuth sometimes does <space><backslash><space>; for instance with the page break. \ (Deep breath.) \ You got that? However, I don't see many cases where a double space is useful. Can you add an example? – egreg Dec 05 '13 at 21:15
  • @Manuel It is used as a graphical convention in some material I am contributing to (yeah, I know it's not the best convention) – Andreas Hettel Dec 05 '13 at 21:16
  • @egreg yes I got It. As an example just imagine a list of letters or symbols, some are separated by a simple space, other by a double space (A B C J K). Then you have the same with words. This does not happen in normal text, only in these "lists". Anyway all proposed solutions are better than what I was using, but \obeyspaces suits best my use case. Didn't know about it, thanks. – Andreas Hettel Dec 05 '13 at 21:24
  • You could just use \quad. – Aditya Dec 05 '13 at 22:09
  • If you only need it in that kind of lists… I think you should define a special command. – Manuel Dec 05 '13 at 22:17

2 Answers2

11

The notion of a double space is very poorly defined and if you try to use it to denote any meaning to the reader it will be massively confusing. TeX is not a typewriter, spaces do not have fixed length they stretch and shrink to adjust words to help with line breaking so words which have a single space between them in the source may already be separated by space that differ by a factor of two between lines that are tight and lines that are loose. a word space in 10pt computer modern is

\glue 3.33333 plus 1.66666 minus 1.11111 

so anywhere between 2.2pt and 5pt.

So a double space on a tight line is smaller than a single space on a loose line.

David Carlisle
  • 757,742
4

You can use a doubled tilde ~~ to get two spaces. But maybe \enskip can help too or you define a command, like \ds (for double space) to be flexible in future if you want to change the width of the doubled space.

spaces in TeX

\documentclass{article}

\newcommand{\ds}{~~}

\begin{document}
H H (normal Space)

H~~H (doubled Space with \verb+~~+, double Tilde)

H\ds H (doubled Space with userdefined \verb+\ds+)

H\enskip H (\verb+\enskip+)

H\quad H (\verb+\quad+)

H\qquad H (\verb+\qquad+)

H\hspace{5em} H (certain space with \verb+\hspace+)
\end{document}

If you need this only in special lists you may define a command taking the list as argument. I used xparse to define a command with a verbatim argument (type v) because \newcommmand will parse the argument and truncate the spaces before \obeyspaces can do its job.

\documentclass{article}

\usepackage{xparse}
\NewDocumentCommand{ \letterlist }{ v }
 {%
  {\obeyspaces#1}%
 }

\begin{document}
            A B  C   D E      F

\letterlist{A B  C   D E      F}
\end{document}

use of \obeyspaces

But the image shows that a single and a double space can be easily confused, so one may consider using other symbols to separate the list …

Tobi
  • 56,353