Latex Tutorial
Latex Tutorial
Contents
1 Intro 2 Equations 2.1 Inline equations . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Floats 3.1 Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Advanced Stu 5 References and Citations 1 2 2 2 3 3 3 4 5
List of Tables
1 Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
List of Figures
1 2 This is a gure . . . . . . . . . . . . . . . . . . . . . . . . . You need to make sure you have the subgure usepackage called before starting the document (see top of this tex document); else this will not work. . . . . . . . . . . . . . . 3
Introduction
You can use latex to do all of the things word processors can do, like color, italics and bold. We can make fonts that are bigger or even
bigger
small
New paragraphs like this on are automatically indented according to the document class that you declared at the beginning of the le. This document uses the article class, which defaults to indenting the beginning of every paragraph except the rst paragraph of a new section. Sometimes you might want to change the way a paragraph is indented by using special commands, like: This! I used the \noindent command to make sure that this paragraph was not indented. Also, notice that above when I wrote \noindent A L TEX did not interpret it as a command, but as text. To do this I used the \verb command.
Equations
A One of the most popular features of L TEX is the ability to make nice looking math equations. Here are some examples:
2f 2f + =0 x2 y 2
(1) (2)
bx 0q
sin
23 x dx 17
Note that if you give your equations labels, then you can reference them in the text, like this: Eq. 1 and Eq. 2. The advantage of using these types of references is that they will always refer to the correct equation, even if you add more in later or rearrange them.
2.1
Inline equations
Sometimes you want to have a short bit of math inside the text, like this: h x = p To do this you can surround your math with $s. Alternatively, h you can use the \ensuremath{}, like this: x = p .
2.2
Align
If you want to have a derivation that take multiple lines and have all the equal signs line up, we can use the align environment.
u = arctan x 1 du = dx 1 + x2
dv = dx v = x.
Note that with both the eqaution and align environments, if you put an asterix after the name in the begin statements (e.g. \begin{align*}), the equations will not be numbered. The same thing works for sections and subsections.
Floats
A Floats are things that L TEX will intelligently place within your text. The most common types of oats are gures and tables.
3.1
Figures
The standard package to use for images is graphicx. And this is what you would do if you would like to have multiple subgures:
3.2
Tables
A Tables in L TEX can sometimes seem tedious, but they are very exible. Note that to make a table we need two environments: rst we need the table environment to make a oat which can contain, among other things, captions, and then we need the tabular environment to actually dene the contents of the table. Technically you could make a table with just the tabular environment, but then it would no be placed intelligently like other oats and could not include captions.
(b) second
Figure 2: You need to make sure you have the subgure usepackage called before starting the document (see top of this tex document); else this will not work. x 71 2 3 4 5 x2 1 4 9 16 25
Advanced Stu
To avoid typing an awkward set of commands over and over again, you can dene your own commands such as: \newcommand{\degree}{\ensuremath{^{\circ}}} Now, whenever you type degree in your .tex document, the compiler will read it as \ensuremath{^{\circ}}.That is, it will place a superscripted A circle in place of \degree\. The \ensuremathcommand means L TEX will read the commands in the braces as being in math mode. You do not want to use inline math ($) here because if you are already in math mode, having the $ signs here will take you out of math mode! Add the command for 180 underneath the current command for partial derivatives. Information for functions and packages is very well documented. Simply search google to see how to do more interesting things.
References in Latex are extremely simple with the use of Bibtex. First, create a .bib le where you can store all of the information about papers youve used. Programs like Google Scholar and PubMed will have Bibtex information about the papers. Simply copy and past the information into a .bib le and use the cite package at the begining of your document. To cite, use ~\cite{} with your paper reference in the brackets. [?]
References