Table of contents

Paragraphs and Spacing

When you are typesetting, LaTeX breaks the content into lines, spaces and paragraphs. In this tutorial, you will learn about them.

Lines

In LaTeX a document is typeset one paragraph at a time and these paragraphs are broken into lines of equal width. If a line is too wide to be broken, the message overfull \hbox is shown. Lines that are too wide are marked with a slug (a black box) which is a vertical bar of width \overfullrule. To avoid the message regarding big paragraphs or lines, you can write the paragraphs inside {\setlength{\hfuzz}{2pt} and }% end of \hfuzz=2pt.There are two forms in which the line breaks in a paragraph while typesetting:

  • The \\ and \newline commands break the line at the point of insertion but do not stretch it.

  • The \linebreak command breaks the line at the point of insertion and stretches the line to make it of the normal width. It can be qualified with an optional argument and the occurrence of the line break depends on the value of the argument. The higher one gives more occurrences.

The text written is in paragraphs after the above given commands are started from a new line without indentation.


	\documentclass{article}
	\usepackage[utf8]{inputenc}
	\begin{document}
	\makebox{Text Box.}End\\
	\makebox[2in][l]{Text Box.}End\\
	\makebox[2in]{Text Box.}End\\
	\makebox[2in][r]{Text Box.}End\\
	\makebox[2in][s]{Text Box.}End
	\end{document}

line-LaTeX-img

If you want to break a line in the middle of a paragraph using the \linebreak command and if LaTeX thinks that is there is too little text left on the line to stretch it to full width, we receive a message like Underfull \hbox (badness 4328) in paragraph at lines 8—12. The variants of the command \\ are given below:

  • \\[length] where length is interline space that the user wants to specify after a line break.

  • \\* prevents from a page to break after the break of a line.

  • \\*[length] combines the above two variants.

Double Spacing

Peter Gordon, an editor at Addison-Wesley, convinced him to write a LaTeX user's manual for publication that came out in 1986 and sold hundreds of thousands of copies. Lamport released versions of his LaTeX macros in 1984 and 1985; and in 1994 released LaTeX 2e, the current standard version, and continue working on LaTeX3. After internet era began, options got available to online LaTeX writing.

Paragraphs

Paragraphs are separated by blank lines and by using the command \par. This form is very useful in user – defined commands and environments as error messages show paragraph breaks as \par. The paragraphs are indented automatically at the beginning of the text which can be prevented by using the command \noindent and can be forced in paragraphs using the command \indent. The indentation provided by and set by the \hangindent and \setlength command respectively creates hanging indents in paragraphs.


    \documentclass{article}
	\usepackage[utf8]{inputenc}
	\begin{document}
	\setlength{\hangindent}{30pt}
	\noindent
	\textbf{sentence} Hello there! 
	How have you been all these days
	\setlength{\hangindent}{30pt}
	\noindent
	\textbf{paragraph} Hello there! 
	How have you been all these days
	\end{document}

line-LaTeX-img

The \setlength command must be repeated for each paragraph. The \hangafter is a length command for paragraphs that specifies that the number of lines that are not supposed to be indented.

Pages

There are two page breaking commands:

  • The command \newpage breaks the page at the point of insertion but does not stretch the content.

  • The command \pagebreak breaks the page at the point of insertion and stretched the content at a normal length.

When a document is finally prepared, the user may have to extend or shrink the page due to unsuitable change of page at a line. The command \enlargethispage{\baselineskip} adds one line to the page length and \enlargethispage{-\baselineskip} makes one line shorter. The \clearpage command is used to do a \newpage and makes all the figures and tables wait till they are processed and the command \cleardoublepage is used with twoside document class option.

If you want to break a line in the middle of a paragraph using the \linebreak command and if LaTeX thinks that is there is too little text left on the line to stretch it to full width, we receive a message like Underfull \hbox (badness 4328) in paragraph at lines 8—12. The variants of the command \\ are given below:

  • \\[length] where length is interline space that the user wants to specify after a line break.

  • \\* prevents from a page to break after the break of a line.

  • \\*[length] combines the above two variants.

Multicolumn printing

The command \twocolumn starts a new page by issuing the \clearpage command and then typesets it in two columns with an optional argument that provides a two – column wide title. The command \onecolumn is used to change the title format to one – column.

Spaces

The spaces are used either horizontally or vertically during the formatting of the document.

Horizontal Spaces

The \quad and \qquad commands create a space of 1 em and 2 em respectively. We also use the commands \hspace with an argument for inserting a horizontal space of the measurement of the argument and \phantom for producing space and whose argument the width and height of the space. The examples of the above commands are given below respectively.

The \hphantom{argument} command is used to create a space with the horizontal dimension that would be occupied by its typeset argument and with zero height.


	\documentclass{article}
	\usepackage[utf8]{inputenc}
	\begin{document}
	\textbar\hspace{12pt}\textbar hello
	\textbar\hspace{.5in}\textbar hello
	\textbar\hspace{1.5cm}\textbar hello
	\end{document}

line-LaTeX-img

	\documentclass{article}
	\usepackage[utf8]{inputenc}
	\begin{document}
	apple \phantom{beta} call \phantom{delta}\\
	\phantom{apple} ball \phantom{call} delta
	\end{document}

line-LaTeX-img

Vertical Spaces

The commands used to insert vertical spaces are as follows:

\vspace{argument}: this command inserts a vertical space whose measurement is given in the argument.
\vfill: this command inserts a blank space that will stretch to fill the vertical space available.
\smallskip: this command adds a 3pt space plus or minus 1pt which depends on other factors.
\medskip: this command adds a 6pt space plus or minus 2pt which depends on other factors.
\bigskip: this command adds a 12pt space plus or minus 4pt which depends on other factors.

Expanding Horizontal Spaces

The commands \hfill, \hrulefill and \dotfill are used to fill the available spaces with spaces, horizontal line and dots respectively.


	\documentclass{article}
	\usepackage[utf8]{inputenc}
	\begin{document}
	a\dotfill bc\\
	ABC\hfill and\hfill DEF\\
	ABC\hrulefill and\hrulefill DEF
	\end{document}

line-LaTeX-img

Expanding Vertical Spaces

The vertical space is put by using the command \vfill which fills the command with vertical spaces such that the text before and after the command touches the upper and lower margin respectively.

Don't want to invest time in typesetting documents manually?

Convert Word to LaTeX now
Copied to Clipboard!