You are on page 1of 30

Installing LATEX Commands

Basics of LATEX

Roxanne Daphne O. Lapaan


University of the Philippines Baguio

05 February 2014

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Installing LATEX

Download and install MikTeX


Download and install TeXnicCenter
Configure TeXnicCenter

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Configuring TeXnicCenter

You will be asked where TeXnicCenter can find your TeX


Distribution. Browse to the directory C: \texmf\miktex\bin
then click next.
Then the program will prompt for the DVI viewer. Browse for
the directory C: \texmf\miktex\bin\yap.exe
Finally the program will prompt for the PDF viewer. Locate it
in your computer then click next.

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Start up Commands

\documentclass[options]{style}
Style include article, report, and book
Options include fontsizes (i.e. 9pt, 10pt, etc.) and paper sizes
(i.e. legalpaper, letterpaper, a4paper).
\begin{document}, \end{document}
Type what you want to see in your output between these two
commands.

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Parts

Preamble
This is what is between
\documentclass
and
\begin{document}
This is where we import packages and include other
modifications to the document.
Document Environment
This is what is between
\begin{document}
and
\end{document}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Example

\documentclass[9pt]{article}

\begin{document}
Hello World!
\end{document}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Basic Commands

\textbf{}
Hello World!
\textit{}
Hello World!
\textsc{}
Hello World!
\noindent
\\
- new line.
\\ plus a space between lines
- new paragraph.

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Alignment Environments

\begin{center}, \end{center}
This text is centered.
\begin{flushleft}, \end{flushleft}
To the left, to the left.
\begin{flushright}, \end{flushright}
To the right, to the right.

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Itemize Environment

This environment
creates a bulleted
list
that can be nested
and nested

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Itemize Environment

\begin{itemize}
\item This environment
\item creates a bulleted
\item list
\begin{itemize}
\item that can be nested
\begin{itemize}
\item and nested
\end{itemize}
\end{itemize}
\end{itemize}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Enumerate Environment

1 This environment
2 creates a numbered
3 list
1 that can be nested
1 and nested

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Enumerate Environment

\begin{enumerate}
\item This environment
\item creates a numbered
\item list
\begin{enumerate}
\item that can be nested
\begin{enumerate}
\item and nested
\end{enumerate}
\end{enumerate}
\end{enumerate}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

To modify the list format, simply use [ ] e.g.

\begin{enumerate}
\item[A.] First item
\item[B.] Second item
\end{enumerate}

This will give an output like this


A. First item
B. Second item

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Typesetting Math
A mathematical expression is enclosed by a dollar sign (for an
inline expression) or a double dollar sign (for a display styled
expression). e.g.

the expression $x+4$

will produce
the expression x + 4

while
the expression $$x+4$$
will produce
the expression
x +4
Lapaan, R. D. February 2014 Basics of LATEX
Installing LATEX Commands

Typesetting Math

^{}
- superscript
_{}
- subscript
\leq
- less than or equal to
\geq
- greater than or equal to

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Typesetting Math

\sqrt{}
- square root
\sqrt[n]{}
- nth root
\frac{numerator}{denominator}
- for fractions
\displaystyle
- for a display styled inline expression

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Example

Typeset:
x2 1
Solve for x in + 2x + 5 =
4 16
Solve for x in
1
1 q
3 x+ 1
x1

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Example

\begin{itemize}
\item Solve for $x$ in
$\displaystyle \frac{x^{2}}{4}+2x +5=\frac{1}{16}$
\item Solve for $x$ in
$$ 1-\frac{1}{\sqrt[3]{x+\frac{1}{\sqrt{x-1}}}} $$
\end{itemize}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Trigonometric Functions

Indeed every letter inside a mathematical expression is considered a


variable in LATEX and is italicized in the output. Hence we have
these commands for Logarithms and Trigonometric Functions:
\cos
\sin
\tan
\sec
\csc
\cot
\log
\ln

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Greek Alphabet

\theta
-
\Theta
-
i.e. The commands for Greek letters are the spelled out letters
itself and if we want a capital Greek letter, we just capitalize the
first letter in the command.

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Example

Typeset:
sin cos
tan + cot = +
cos sin

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Example

$$\tan \theta + \cot \theta=


\frac{\sin \theta}{\cos \theta} +
\frac{\cos \theta}{\sin \theta}$$

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Integrals and Derivatives

\int_{lowerlimit}^{upperlimit}
Z upperlimit

lowerlimit
\frac{dx}{dt}
dx
dt
\frac{\partial x}{\partial t}
x
t

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Summations and Products

\sum_{n=1}^{k}
k
X

n=1

\prod_{n=1}^{k}
k
Y

n=1

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Resizing Grouping Symbols

Why resize?
Unresized:
x +1
( )
x2 + 1
Resized:  
x +1
x2 + 1

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Resizing Grouping Symbols

How to resize?
\left( <insert expression here> \right)
\left\{ <insert expression here> \right\}
\left[ <insert expression here> \right]
So basically, you just use

\left, \right

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Aligning Expressions

Suppose you want an output that looks like:

2x + 5 7
2x + 5 5 7 5
2x 2
2x 2

2 2
x 1

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Aligning Expressions

Use the align or align* environment which is available in the


amsmath package.
Whats the difference? align puts an equation number in every line
while align* does not.
How to use align:
Import the amsmath package. That is, in the preamble, type
\usepackage{amsmath}
Precede the symbol/expression you want to align with the
others in an ampersand (&)
End the current expression line with a double backslash (\\)

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Aligning Expressions

So to produce the sequence of expressions seen earlier, we have the


following code:

\begin{align*}
2x+5 &\leq 7\\
2x+5 - 5 &\leq 7 -5\\
2x &\leq 2\\
\frac{2x}{2} &\leq \frac{2}{2}\\
x &\leq 1
\end{align*}

Lapaan, R. D. February 2014 Basics of LATEX


Installing LATEX Commands

Thank You! : )

Lapaan, R. D. February 2014 Basics of LATEX

You might also like