Latex
Latex
Getting Started
First, assuming that you use windows there are a few
things that need to be installed.
The first of these is MikTeX. This is the software used to
compile the files into a presentable format. It also
includes a Dvi viewer. Dvi is the default out put for Latex.
It has numerous disadvantages to PDF format. The main
disadvantage is that the picutures can only be in eps or
png format while PDF supports jpg and bmp aswell.
The next software that needs to be installed is the editor. I
will used Texnic Center. It is the free version. There are
alternatives such as WinEdt, but they cost money. One
other alternative is Texmaker, but it has not been fully
implemented yet
Installation notes
Install Miktex first, unless you dont have a
PDF viewer.
The binary files for compilation are in
C:\Program Files\MiKTeX 2.5\miktex\bin
This directory is important for when the
editor is being installed.
Change version number based on the
version downloaded.
Next install the editor.
Document Class
This is the first line.
It starts \documentclass[options]{Class}
Options are often specific to the class but
there are generic options for both.
There are 4 main classes: article, letter,
book, and slides
Each of these can have options
associated with it. These options will
define the document structure and look.
Options
First define the font size. Options are 10pt, 11pt,
and 12pt, They are typed exactly like that.
Use commas and only commas to separate
options.
The next option you can define is paper size. If
you just want regular printer paper dont put any
thing. Options for this are letterpaper, a4paper,
a5paper, b5paper, executivepaper, and
legalpaper.
Columns:
You can specify one or two colums with onecolumn or
twocolumn
Examples
Example 1: 12pt font, regular paper, two
columns with a title page
AMS
\documentclass[12pt,twocolumn,titlepage]{article}
Physical Review
\documentclass[aps,prl,twocolumn,oneside,floatfix]
{revtex4}
New options for the package being used. Aps and pr; are
just defining options. Oneside, which is not needed, will
format to print to one side of a page. Floatfix will anchor
floating objects to the pages. They can otherwise be sent
to a page of floats.
More Examples
Example 2: 12pt font, regular paper, one
column columns with no title page
AMS
\documentclass[12pt]{article}
Physical Review
\documentclass[aps,prl,oneside,floatfix]{revtex4}
Necessary packages
When doing a generic paper there is one
package that must be loaded.
That is: \usepackage[latin1]{inputenc}
This calls the inputenc package and uses latin1
as its option.
There are many other options than latin1 but for
the most part they look the same. They are:
ansinew, applemac, latin1, latin2, latin3, latin4,
latin5, latin9, latin10, cp437, cp850, cp852,
cp858, cp865,, cp866, cp1250, cp1252, cp1257,
decmulti, and next. [1]
More
If you plan on using any math then there
are 3 packages that are a must. They are:
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
If you plan on using images use
\uspackage{graphicx}
Generic Title
The Generic title and the Physical review titles
are done differently
The generic title will automatically put the date in
for you.
You begin this section with the \title command.
\title{title name}
This will offset the title by itself with its own font.
Next is the \author{author info} tag.
Generic \author
The generic version of this tag is a little different than it is for the
Physical Review.
In the generic tag you must also define affiliation information here.
Its structure is:
\author{name \\ Department Name \\ College Name \\ City, State, Zip
code}
I have introduce a new command here. When you are writing Latex
will not register hitting enter as you wanting to go to the next line.
You must tell the compiler to go to a new line with the \\ command.
This command will apply any where in the document.
You finish this section off with the make title command.
It is \maketitle
Title
Your name
Department name
College name
City State Zipcode
Date
Inserting math
There are many ways to insert math
equations into Latex. Which way used all
depends on what your situation is.
Situation 1:
Situation 2
You need an equation by itself. That is
also numbered. You do this with
\begin{equation}
Equation
\end{equation}
If you wish to leave it unnumbered simply
put an asterisk at the end of the word
equation. \begin{equation*} equation
\end{equation}
Lets expand.
b
d 2 R
rs dv
I
2
dt
The output
Inserting Images
Most editors will have an image inserter, but
it will not hurt to know how to do it your self.
Here is the what your type
\begin{figure}[Position]
\includegraphics[width=\columnwidth]
{Filename}
\caption{ caption \\ \hline \label{figure#:}}
\end{figure}
The parts
The position is really tricky, Options are
T top of page
R Right side of page
! - let the compiler decide
Any combination can be used.
From my experience the compiler will put the image where ever
it feels like on the page that you are typing on. Just play around
with it until you get it where you want it. Sometimes it is even
useful to wait until you are done before you put in figures so that
you can see where every thing will go.
Finishing Pictures
There are still two more issues to discuss. That is the width and file
names.
This used \columnwidth to set the picture size. This will probably be
desirable only for the case where you used two columns.
Other than that you use decimal points to represent the desired
size. 25% = 0.25
File names are a final consideration. PDF format has support for
multiple files, including png and jpg. I usually use png because it is
default. The file names are case sensitive. The picture must lie in
the directory that the rest of the files are in, and it can not have any
spaces in the name.
This is just a consequence of this originally being in Linux
\begin{table} [tr!]
\begin{ruledtabular}
\begin{tabular}{| c | c | c | c |}
\hline
$\lambda$(nm) &
$\lambda$ (m)
& $\frac{c}{\lambda}$
\hline
405
& 0.000000405 & 7.41E+14
& 0.815
\\
\hline
435.8
& 4.358E-07
& 6.88E+14 & 0.532
\\
\hline
546.1
& 5.461E-07
& 5.49E+14 & 0.499
\\
\hline
577.7
& 5.777E-07
& 5.19E+14 & 0.438
\\
\hline \hline
slope
& 3.28E-15 & $\frac{\phi}{e}$ & 1.4586 $^2$\\
\hline
$h_{theoretical}$ & 6.626E$-$34 & $h_{measured}$ & 5.16167E-34 \\
\hline
\end{tabular}
\end{ruledtabular}
\caption{This table is the data taken during this experiment.
\label{table1:}}
\end{table}
& Voltage(V) \\
\begin{tabular}{| c | c | c | c |}
\hline
$\lambda$(nm) &
$\lambda$ (m) & $\frac{c}{\lambda} & Voltage(V)
\hline
405
& 0.000000405 & 7.41E+14
& 0.815 \\
\hline
435.8
& 4.358E-07
& 6.88E+14
& 0.532 \\
\hline
546.1
& 5.461E-07
& 5.49E+14
& 0.499 \\
\hline
577.7
& 5.777E-07
& 5.19E+14
& 0.438 \\
\hline \hline
slope
& 3.28E-15 & $\frac{\phi}{e}$ & 1.4586 $^2$\\
\hline
$h_{theoretical}$ & 6.626E$-$34 & $h_{measured}$ & 5.16167E-34 \\
\hline
\end{tabular}
(explain to them from memory)
\\
Final Statements
Latex can be used even out side of the narrow
limits that I have explored it in. A little google, or
wikibooks search will uncover lots of information
for any issue.
Even everyday MLA papers can be written with
it. I have a link in the Links section. There will be
many things put up on the CSC website from
this slide show, and then some.
You can contact me at [email protected] or at
x6484
Links
http://www.miktex.org/
http://www.toolscenter.org/
http://www.ocf.berkeley.edu/~jjlin/latex/
http://en.wikibooks.org/wiki/LaTeX
http://web.ift.uib.no/Fysisk/Teori/KURS/
WRK/TeX/symALL.html