New version page

UI STAT 5400 - Introduction to LATEX

Documents in this Course
Load more
Upgrade to remove ads
Upgrade to remove ads
Unformatted text preview:

122S:166Computing in StatisticsIntroduction to LATEXLecture 3Sept. 5, 2007Kate Cowles374 SH, [email protected] learn LATEX?• easy to produce professional-lookin g mathe-matical formulas• easy to l a bel equations, citations, figures, ta-bles, etc. to au tomate cross-referencing• can be used on any type of computer (PC,workstation, main frame)• freely available• installed in many universities and researchinstitutions• .tex files are plain text: can be producedwith any text editor and emailed to co-authors– doesn’t require that all have same typeof compu ter or same word-processing soft-ware3• .dvi fil es produced in LATEX processing canbe viewed on screen and printed on almostall kin ds of printers– dvi is short for device independent• particularly useful to academics; many jour-nals now want electronic submission of manuscriptsin LATEX format4Using LATEX in the UI MathematicalSciences educational laboratories1. prepare source file : <name>.tex in text ed-itor• filename extension must be .tex2. spell check source file:ispell <name>.tex3. process source file:latex <name>4. check that the following files exist: <name>.log,<name>.aux, <name>.dvi5. view .dvi file (background job):xdvi <name> &• check document on screen before printingto save paper and money6. convert .dvi file to Postscript (.ps) file:dvips <name> -o <ps file name>.ps57. view .ps file (background job):ghostview <ps file name>.ps &8. (optional) format multiple pages into a singlesheet:psnup -nup <number of pages> -m<margin size> <ps filename>.ps <new ps file name>9. (optional) convert .ps file to .pdf file:ps2pdf <ps file name>.ps <pdf file name>.pdf10. (optional) view .pdf file (background):acroread <pdf file name>.pdf &11. .dvi and especially .ps and .pdf files canbe large, so smart to delete th em when you’redone usi ng them• don’t delete the .tex file!Note: There is no need to restart the viewing ap-plication after you have modified a file. The con-tent of these windows will be updated automat-ically, or by using File/Reopen or File/Open.6Basic LATEX• current version of LATEX is LATEX 2ε.• previous version was LATEX 2.09.• lines that must appear in every LATEX do c-ument:\documentclass{ <class> }\begin{document}\end{document}• classes of documents producing different de-fault formats– article– report– book– slides– letter7Sample .tex file% articletemplate.tex\documentclass[12 pt]{article} % statement required; 12 pt optional%preamble\usepackage[dvips]{graphics}\usepackage{amssymb, amsmath}\makeindex% start document\begin{document} % required% article heading\title{ Example of \LaTeX\ document }\author{ Kate Cowles }\date{ \today }\maketitle% \tableofcontents\begin{abstract}This article demonstrates usage of basic \LaTeX\ features.\end{abstract}8\section{Automatic paragraph formatting} \label{autoform}This is paragraph 1.To start a new paragraph, simply leave one or moreblank lines. \LaTeX\ will do the indentingautomatically. \LaTeX\ automatically indents thefirst line in all paragraphs except the first in asection.It doesn’t matter how many spaces youleave in betweenwords or where you breaklines---\LaTeX\ considers a carriage return (where you pressed‘‘Enter")as just another space between words.\section{Special characters in \LaTeX} \label{specchar}The following characters are special codes in \LaTeX:\&, \$. \%, \~, \_. \{, \}, \#, and \^. To printone of these characters literally, you must put abackslash before it. The backslash itself obviouslyalso is a special character.\subsection{\%} \label{pcntsign}9The percent sign is used to insert comments in a{\tt .tex} file. It tells \LaTeX\ to ignoreeverything that comes after it on the line. My mostcommon error in \LaTeX\ is to forget to put the backslashbefore the % sign, so that several words areomitted from the output.\section{Mathematical expressions} \label{mathexp}Mathematical expressions may be included in the textof a paragraph by putting a dollar sign at thebeginning and the end of each, like this: $e = mc^2$.The special backslash character is printed with$\backslash$.Alternatively, a mathematical expression may be setoff on its own line like this:\[e = mc^2\]Also, \LaTeX\ can number equations and keep trackof the numbering for you, like this:\begin{equation}\label{equa}e = mc^2\end{equation}10\section{Using labels} \label{labels}Because we have used labels on our sections andequation, we can refer to them without having toremember the numbers ourselves. For example,equation~(\ref{equa}) appeared in section \ref{mathexp}.This capability is particularly handy when we addsections or equations, or reorganize a document.\section{Environments}\label{envi}An \emph{environment} is a section of a \LaTeX\ documentthat is processed in a special way. Usually the sectionbegins with\begin{verbatim}\begin{ < environment name > }\end{ver*batim}and ends with\begin{verbatim}\end{ < environment name > }\end{ver*batim}\subsection{Lists}\LaTeX\ has two list environments:11\begin{itemize}\item bulleted lists\item numbered lists\begin{enumerate}\item differ from bulleted lists in theenvironment name\item lists can be nested within lists\end{enumerate}\end{itemize}\subsection{Tables}The {\tt tabulate} environment formats the rows and columnswhile the {\tt table} environment provides captions, that is:\begin{table}[h]\begin{center}\begin{tabular}{ll}environment name & function \\\hlinetabular & define rows, columns, titles \\table & add captions; make environment ‘‘floating’’ \\\hline\end{tabular}\end{center}\caption{Environments for Tables}\label{tabl}\end{table}12Options concerning table placement may appear in square bracketsthe environment name {\tt table}. The choices are:\begin{itemize}\item {\tt [h]} --- here (where typed in document)\item {\tt [t]} --- top of page\item {\tt [b]} --- bottom of page\item {\tt [p]} --- on separate page with other floaters\end{itemize}\end{document} % required13Special document class for creating slide presentations with Powerpoint-like features:


View Full Document
Download Introduction to LATEX
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to LATEX and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to LATEX 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?