In the previous article, we see how to install LaTeX. In this lesson, we will see how you create your first LaTeX document. The extension used for the LaTeX file is .tex. This file has two parts i.e. preamble and body.
Part-1: Preamble
The preamble contains information regarding document type, page formatting parameters (font size, paper size, etc.), additional LaTeX packages (if required), header setting, footer setting, etc. The preamble can start either with \documentclass{doctype} or \documentclass[po1,po2,…]{doctype}.
The doctype in {} represents the document type such as article, report, letter, book. For example,
\documentclass{article}
\documentclass{report}
\documentclass{letter}
\documentclass{book}
The po1, po2,…. in [] represents the user defined formats for a document. These formats are font size, paper size, page orientation, columns of texts, type of printing, new chapter, title printing, equation, drafting and bibliography.
The standard font size options are
- 10 pt (default)
- 11 pt
- 12 pt
The standard paper size options are
- letterpaper (default)
- a4paper
- a5paper
- b5paper
- legalpaper
- executivepaper
The standard page orientation options are
- portrait (default)
- landscape
The standard columns of texts options are
- onecolumn (default)
- twocolumn
The standard type of printing options are
- oneside (default for report and article)
- twoside (default for book)
The standard new chapter options are
- openany
- openright (default for book)
The standard title printing options are
- titlepage
- notitlepage
The standard equation options are
- leqno
- fleqn
The standard drafting options are
- final (default)
- draft
The standard bibliography option is
- openbib
Part-2: Body
The second part is the body. The main content of your document is written in the body. It starts with the instruction \begin{document} and ends with the instruction \end{document}.
Let’s write our first LaTeX document. In this, we create a file having document class as article.
\documentclass{article} \begin{document} Welcome to Electricalvoice.com \end{document}
The output is