Paragraph 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}
Example of a line break:  \\
Example of a \\ line break  \\
Example \newline of a line break  \\
Example of\linebreak a line break  \\
\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 :

The documents that are double spaced are really convenient to read. To typeset the document double spaced, we have to write the command \renewcommand{\baselinestretch}{1.5} using the package setspace. The command \doublespacing not only changes the line but also other parameters so that the article looks good.

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-boxes-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}

                  

hoziontal-space-LaTeX-img

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

                  

hoziontal-space-LaTeX1-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}


                  

expand-horizontal-space-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.

If you are finding Formatting document difficult using LaTeX, no worries, just send us your document and Get it formatted according guidlines.