2. A bare bones page


A LaTex source document is conceptually a simple structure, with just two parts: a set of global declarations and the content, wrapped between \begin{document} and \end{document}. The first two lines in the code snippet below form the preamble part; the subsequent three lines are the content part.

  1. documentclass [x] {y}
  2. \usepackage{x,y,z}
  3. \begin{document}
  4. < content of the document >
  5. \end{document}

A quick summary of what the lines mean follows.

1. \docmentclass [x]{y}, where [x} contains a set of options for the document layout and {y} specifies the underlying document class template. Any declaration within the preamble is considered global, and any declaration within the body is considered local.
2. \usepackage{x,y,z}: list of packages to be pre-loaded, global style statements and mark-up options.
3. \begin{document}, which marks the beginning of second part, containing content
4. Main body of content
5. \end{document}.

Items 1 & 2 make up the style declaration part; 3,4 and 5 are the content part.
The code below demonstrates an actual use case; Figure 2.1 below illustrates the output .

1. \documentclass{article}
2. \usepackage{lipsum} % calls a package containing dummy text
3. \begin{document}
4. \lipsum[2-5] %calls para two to five of lipsum dummy text
5. \end{document}

Figure 2.1: Barebones document, with minimal options

In the code snippet above:

Line #1: Defines the document layout. We have called an article document class, with no other options {x}. LaTex uses a default point size of 10pt.

Line #2: The \usepackage{lipsum} loads the Lorem Ipsum package, also called lipsum. This package contains dummy text. It will be invoked by paragraph numbers at the required/desired spot in the document. Wikipedia defines Lorem Ipsum as:

“In publishing and graphic design, Lorem Ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content.

Line #3: Defines the beginning of the actual content.

Line #4: Calls para two to five of the lipsum dummy text;

Line #5: Marks the end of the content. All the matter enclosed between\begin {document} and \end{document} will be compiled as per instructions in the preamble (lines 1-2).

The output on the right of Figure 2.1 has:
• Four paragraphs of text—paras two to five of Iipsum.
• First line of each para is indented;
• Text in the main body is fully justified, both on left edge and right edge;
• The font in the document is Computer Modern Roman (CMR), the Latex default font. The default is loaded when no font family is specified.

Except for the content (lipsum[2-5]), the rest of the output is based on default options. The output is not a bad result from five lines of code. It is clean and visually appealing. In the next chapter, we will stack various options in place of defaults.