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.

In HTML, to get extra horizontal spacing all I would have to do is:

This is textual phrase A   This is textual phrase B

to get the following output:

This is textual phrase A...This is textual Phrase B

. = 1 invisible space character

Question#1: How do you force insert space characters?

Question#2: What is the proper way to fine control horizontal spacing instead of force adding space characters?

share|improve this question
2  
What do you want to achieve in the "fine control" you ask about in your second question? If you explained that, it might become an answerable question :) –  Mariano Suárez-Alvarez Jul 24 '11 at 4:08
    
Fine control as in I can specify by a metric value instead of calculating how many space characters to insert, The \hspace{5em} example from Werner seems to be the best answer. –  Level1Coder Jul 24 '11 at 4:14
1  
You'll find a list of the different kinds of lengths you can specify in LaTeX here. –  Werner Jul 24 '11 at 4:23
add comment

3 Answers

up vote 16 down vote accepted

In answer to your first question: There are many ways of adding specific spaces to text. Some examples include forcing an actual "inter word space" to specifying a regular space length to specifying a length based on an object (text or otherwise). In that order you can use the following:

\documentclass{minimal}%
\begin{document}
This is textual phrase A\ \ \ This is textual phrase B% 3 inter word spaces
\par
This is textual phrase A\hspace{5em}This is textual phrase B% space of length 5em
\par
This is textual phrase A\hphantom{spaces}This is textual phrase B% space equivalent to length of word 'spaces'
\par
This is textual phrase A\hfill{}This is textual phrase B% infinitely stretchable space
\end{document}

This is the equivalent output:

Different spaces

Perhaps some of these methods answer your second question. However, in its general context, the answers are probably too many to list here.

share|improve this answer
add comment
  1. In (La)TeX, a 'tie' ~ is the exactly equivelant of   in HTML, say, no-break space. However, it is often misused in documents.

    See here to know: When should I use non-breaking space?

  2. It is a large topic. Generally speaking, it is better to prevent the direct using of most spacing commands in LaTeX documents. Just use semantic commands and define some if necessary. (c.f. Do semantics matter in LaTeX? If not, why not?) That's to say, one should use quote, itemize, verse, quotation, abstract instead of many \, ~, \quad, \qquad, \; or \hspace's. Do fine turning when necessary only.

    Example:

    % Good
    \title{Foo}
    \author{Bar}
    \maketitle
    

    Versus

    % Bad
    \begin{center}
    {\Large Foo}\\
    Bar
    \end{center}
    

    Versus

    % Awful
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~\Large{Foo}\\
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Bar
    

    Possible fine turning:

    \documentclass{article}
    
    % turn the format in preamble
    \usepackage{titling}
    \pretitle{\begin{center}\LARGE\bfseries}
    \posttitle{\end{center}\vspace{2ex}}
    
    \title{Foo}
    \author{Bar}
    
    \begin{document}
    \maketitle
    % ...
    \end{document}
    
share|improve this answer
add comment

Section 6.3 of, 'The Not So Short Introduction to LaTeX', has a few details too.

share|improve this answer
add comment

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.