A TO L TEX
FIRST VERSION
\howto
TEX {.com}
This document is copyrighted by howtoTeX.com. Feel free to distribute, but keep a reference to howtoTeX.com and its original authors.
Contents
A 1 L TEX Basics 1.1 Document structure 1.1.1 Preamble . . 1.1.2 Environments 1.1.3 Sectioning . . 1.2 Text formatting . . . 1.3 Cross references . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
1 1 1 1 1 1 1 2 2 2 2 3 3 4 4 4
2 Typesetting content 2.1 Equations . . . . . . 2.1.1 Working with 2.2 Figures . . . . . . . 2.3 Tables . . . . . . . . 2.4 Lists . . . . . . . . .
. . . units . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
3 Bibliography with BibTEX 3.1 Using BibTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Adding bibliography items . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preface
The title of this document says it all: this is a five minute guide to A L TEX, a way of typesetting documents that will save time and frustration. This guide is written to get you over the fairly steep learning curve. More A L TEX guides exist, but they all drown you in information. The content of this guide will teach you enough to write proper documents. A Before you can start, the L TEX system needs to be installed. A guide for Windows and Mac OS X is found here. To make life even easier, download A this folder structure to start L TEXing right away. May 27, 2012
CHAPTER 1
A L TEX Basics
A Together with this guide comes a pre-made folder structure for managing L TEX projects. The latest version is available here. Its advised to open and play with it when following this guide.
1.1.1 Preamble
A A L TEX document is congured in the preamble. The \documentclass[]{} command denes the documentclass , where [] contains optional arguments such as font size. The class is chosen between {}. Standard classes are article, book, report, slides, and letter.
documentclass
Example 1
\documentclass[10pt]{report}
A The preamble also calls required packages : L TEX tools. In the provided preamble all necessary packages are called, together with a brief explanation.
1.1.2 Environments
Environments contain special content, such as math, gures, tables, etc. Environments start with \begin{} and end with \end{}, where the environment name is between {}. The document environment is most important: all content within this environment will be printed.
1.1.3 Sectioning
A distinct part or subdivision of a writing is created with: \section{}, \subsection{}, \subsubsection{}, \paragraph{}, where {} contains the title. The report and book classes require an additional \chapter{} command.
label reference
CHAPTER 2
Typesetting content 2.1 Equations
Equations and other mathematical expressions are created within math environments. There are two types of math environments: inline and display. Inline equations are shown within the paragraph and are created by writing the equation between $ and $. Example 2 Creating an inline equation The derivative of x2 is 2x
display equation inline equation
Display equations are used for larger equations, as they are shown in distinct paragraphs. The amsmath package introduces the align environment for display equations. Example 3 Creating a display equation y0 =
256 2 = 23 = 8
(2.1)
Subscripts can be made with _{} and superscripts with ^{}. Use & to vertically align the equations and add \\ to break a line. A label is added to the environment, such that a cross reference to equation (2.1) can be made with \cref{eq:example}. In order to suppress the automatic equation numbering, use the align* environment or add \nonumber to the desired line.
suppress numbering
2.2 Figures
Place gures in the provided gs folder. A gure is dened with a figure environment and its placement is determined by an optional argument between []: [h] stands for here, [b] for bottom, [t] for top and [p] for separate page. To insert a gure, use \includegraphics[]{}, where [] contains the size and {} the lename. Center a gure with \centering. Also, a label and caption should be assigned. Example 5 Inserting a gure named logo.pdf
gs folder gure placement
\howto
TEX {.com}
2.3 Tables
For nice looking tables, the booktabs package is recommended. A table is placed within a table environment: rst a caption and label are dened, whereafter a tabular environment follows. In the latter, the content of the table can be placed. Table rules are created with \toprule, \midrule and \bottomrule. Example 6 Creating a table
table rule
\begin{table}[h] \centering \caption{Table caption} \label{tb:table} \begin{tabular}{crl} \toprule Name & Grade & Year \midrule John & 7.5 & 2012\\ Richard & 2 & 2010\\ \bottomrule \end{tabular} \end{table}
Grade 7.5 2
John Richard
Similar to gures, table placement can be specied by [h], [t], [b] or [p]. The argument {crl} behind \begin{tabular} determines the column alignment : the rst is centered with c, the second is right aligned with r and the last is left aligned with l.
2.4 Lists
In order to make lists, a listing environment must be created. The enumerate environment creates numbered lists . Example 7 Creating a numbered list 1. First entry 2. Second entry
bulleted list descriptive list numbered list
Similar, bulleted lists () are created with the itemize environment. It is possible to create nested lists by placing one listing environment into another. Descriptive lists are created using the description environment. Example 8 Creating a descriptive list First entry Second entry
CHAPTER 3
Bibliography with BibTEX 3.1 Using BibTEX
BibTEX provides a convenient way to create a consistent list of references. The provided refs folder contains a le references.bib, in which the bibliography items are listed. The bibliography style is determined by \bibliographystyle{plain}, where plain is the default style. The bibliography is printed by the command \bibliography{refs/references}. A A To compile or update the bibliography: run L TEX, then BibTEX and then L TEX twice more.
bibliography
compilation
@book{Last2012, author = {Last, First von}, title = {Book}, publisher = {Publisher}, year = {2012}, }
In the rst line, the reference name is assigned: Last2012. Use \cite{Last2012} to cite A the reference in the L TEX document, resulting in: [1]. If no citation is made to the entry, it will not be added to the bibliography. Making BibTEX entries can often be simplied with the help of internet: most article/book databases, such as Google Books and ScienceDirect, provide BibTEX les.
citation