Saturday, 14 September 2013

LaTeX: Paragraph, Spacing, and Indentation

Let us visit the history of Statistics (source here), and utilize this for demonstrations of paragraph, spacing, and indentation in $\mathrm{\LaTeX}$. Consider the following:


Output 1
Executing these, we will have Output 1. This is the simplest way we can do to separate multiple paragraphs in $\mathrm{\LaTeX}$. That is, by allotting single white space between them (paragraph), or that is two white spaces from the last line of the preceding paragraph.

Output 2
To extend the distance between passages, say into double line spacing, just put \\ at every end of it and you will have Output 2. Hence from the above codes, the first paragraph will end with Ibrahim Al-Kadi.\\, second with element in history.\\, and so on. There is option for the magnitude of space, say 0.5 centimeter, or 0.2 inch spacing is achieve by \\[0.5cm] and \\[0.2in], respectively. Now what happen when white spaces are omitted on the above codes, and leave \\ at the end of every paragraphs? I want you to explore that.

I have shown you the manual procedure so far. Manual in the sense that, every time we want space between the passages we manually put \\[option] with optional option. We can actually declare spacing globally, and that is by setting the length of \parskip, for example \setlength{\parskip}{0.3cm} extends 0.3 centimeter space between the paragraphs.

Any declaration within the preamble is considered global, and any declaration within the body is considered local.

What about the spacing between the lines? How can we modify this?

To globally declare line spacing, we use the package \setspace (reference here) then immediately next to that is the desired spacing. Thus at this point, we have a preamble that looks like this.

What happen here is that all spaces will expand doubly including spaces between the title and the first paragraph. Alternatively, however, we can declare spacing locally, such as for a specific paragraph only. Consider this,

What we have done here, is we deactivate the \setspace and the \doublespace with % symbol, a character use for comments. Texts next to it are considered comments and will be ignored during the compilation. Thus, the document will have default (single) line spacing. But we added \baselineskip to 2 points on the first paragraph, enclosed in braces, {}. The effect here would be 2 points skip (or double space) between the lines of the first paragraph only. Never remove the white space (line 20 above) between the last line (line 19) of the first passage and the closing brace, } (line 21), because if you do, \baselineskip wont take effect; and therefore spacing matters for this function.

Braces are also use for scope beside for enclosing arguments. $\mathrm{\LaTeX}$ functions such as \baselineskip will take effect within braces, {}, only if enclosed by these characters.

Notice every paragraph are automatically indented, this is the effect of the double white space between passages, you can remove the indentation using \noindent. Recall that \\ is a newline function; when used, texts following this are moved to the next line with no indentation. Hence, for indentation use \indent.

No comments:

Post a Comment