Introduction to L A TEX 2. Document structure Markus Harju Mathematical Sciences
2. Document structure Johdatus LaTeXiin (2/12) a Document classes The basic document classes in L A TEX are article, report and book. They are taken into use by starting the input file with the command \documentclass{class} One can supply options to document class as optional arguments: \documentclass[12pt, a4paper]{article} Other options include: 10pt (default), 11pt letterpaper (default), b5paper, a5paper,... draft (marks oversized lines), final (default, does not mark oversized lines) twoside (outputs text for book-like two-sided printing) twocolumn (outputs text into two columns).
a Document parts I Any document of reasonable length should be divided into sections, subsections, subsubsections, etc. This is done in article class with commands \section{} \subsection{} \subsubsection{} \paragraph{} \subparagraph{} report and book classes provide also \chapter{} There is also a \part{} command which does not affect the sectioning numbering. Note that this concerns only structure, not formatting. 2. Document structure Johdatus LaTeXiin (3/12)
Document parts II a The sectioning commands are usually used in the form \section[short title]{title} where short title is optional and meant for table of contents. L A TEX numbers sections automatically. The numbering can be avoided by adding asterisk sign (*), for example: \section*{unnumbered title} The \appendix command accepts no arguments and changes the section numbering to capital letters A, B, C,... It is useful for typesetting appendices, for example: \appendix \section{one long proof} \newpage command starts a new page Demo: Document sectioning. 2. Document structure Johdatus LaTeXiin (4/12)
a Table of contents \tableofcontents command produces the table of contents automatically right where it is given Table of contents is produced based on the previous L A TEX run. That s why it is sometimes necessary to run L A TEX twice to get the contents right. Unnumbered section titles are not included in the table of contents Demo: How to make a table of contents 2. Document structure Johdatus LaTeXiin (5/12)
2. Document structure Johdatus LaTeXiin (6/12) a Title page Title page is produced with the \maketitle command For that to work one must specify the title and author of the document in the preamble. The date command is optional. More than one author can be separated by the \and command An example: \documentclass{article} \author{m. Harju \and T. Harju} \title{dokumentin rakenne} \date{14.9.2016} \begin{document} \maketitle \end{document} Title page is put to separate page by supplying the titlepage option in article class
a Environments Environments are used to specify parts of the document that are to be formatted differently An environment is started with \begin{name} and ended with \end{name}, where name is the name of the environment. Each environment that is started must be ended too! Environments can be inside other environments, for example: \begin{ymp1} Oh, we are inside environment ymp1 Let s start another environment... \begin{ymp2} Some text... \end{ymp2} \end{ymp1} Note that you must start and end environments in correct order! (try) 2. Document structure Johdatus LaTeXiin (7/12)
Cool environments I a Abstracts are made with abstract environment: \begin{abstract} This thesis proves huge things. \end{abstract} The environments flushleft, center and flushright produce text that is either left justified, centered or right justified. For example: \begin{flushright} This text is justified to right margin and not to both left and right as is usually the case. \end{flushright} Demo: Illustrate abstract and justified text. 2. Document structure Johdatus LaTeXiin (8/12)
a Cool environments II Enumerated lists are made with enumerate environment. For example: \begin{enumerate} \item Do the dishes \item Run the vacuum cleaner \item Do the laundry \end{enumerate} 1. Do the dishes 2. Run the vacuum cleaner 3. Do the laundry List labels can be formatted also manually by using an optional argument. For example, \item[(a)],\item[(b)],... Bulleted (unnumbered) list similarly with the itemize environment. Demo: Making of lists 2. Document structure Johdatus LaTeXiin (9/12)
2. Document structure Johdatus LaTeXiin (10/12) a Cool environments III description environment is appropriate when a number of words or expressions are to be defined: \begin{description} \item[dvi] Device Independent. \item[pdf] Portable Document Format. \item[ps] PostScript. \end{description} DVI Device Independent. PDF Portable Document Format. PS PostScript.