DOC PREVIEW
UI STAT 5400 - Computing in Statistics

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

122S:166Computing in StatisticsIntroduction to LATEXLecture 3Aug. 29, 2011Kate Cowles374 SH, [email protected] learn LATEX ?• easy to produce professional-looking 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 file s 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 f o rmat4Processing LATEX documents (manual,step-by-step metho d w hen you haveno graphics files or Postscriptgraphics to include)1. 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 befo re printingto save paper and money56. convert .dvi file to Postscript (.ps) file:dvips <name> -o <ps file name>.ps7. view .ps file (background job):evince <ps file name>.ps &8. (optional) format multiple pages into a singl esheet: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):evince <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: Th ere is no need to restart the viewin g ap-plication after you have modified a file. The con-6tent of these windows will be updated automat-ically, or by using File/Reopen or File/Open.7More on processing LATEX documents• integrated LATEX text editing a nd documentpreparation environments– Emacs – for Linux; install ed on Linux net-work∗ has add-ons to do the latex and xdvisteps∗ has macros to insert some LATEX com-mands– Kile – for Linux; installed on Linux net-work∗ integrates processing of multiple file doc-uments, including BibTeX– TeXnicCenter – for Windows; installed onCSG-managed Wi ndows machines• different steps may be necessary f o r incor-porating d ifferent kinds of graphi cs files intodocuments8Basic LATEX• current version of LATEX is LATEX 2ε.• previous version was LATEX 2.09.• lines that must appear in every LATEX doc-ument:\documentclass{ <class> }\begin{document}\end{document}• classes of documents producing different de-fault formats– article– report– book– slides– letter9Sample .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}10\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}11The 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}12\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\LARGE\begin{verbatim}\begin{ < environment name > }\end{ver*batim}and ends with\begin{verbatim}\end{ < environment name > }\end{ver*batim}\subsection{Lists}13\LaTeX\ has two list environments:\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\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}14\end{table}Options 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


View Full Document

UI STAT 5400 - Computing in Statistics

Documents in this Course
Load more
Download Computing in Statistics
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 Computing in Statistics 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 Computing in Statistics 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?