\documentclass{report} \usepackage[vmargin={3cm,2cm},hmargin=3cm,noheadfoot]{geometry} \usepackage{parskip} \begin{document} \begin{large} UW Instructional Computing Services \end{large} \begin{Large} \LaTeX\ for Research and Teaching \end{Large} Robin Hill\\ \today The typesetting suite \LaTeX\ serves as a batch word processor, popular with academics in the sciences, with comprehensive and precise control over notation, layout, and structure. Composition is done with a text editor, typing both content and commands into a plain text \texttt{.tex"} file. {\bfseries \large Example of Code and Commands} Suppose we wanted an equation showing that the cardinality of the powerset of a set S is the sum of the number of subsets of each size n, for n from 0 to cardinality of S. We would type this: \begin{verbatim} \begin{displaymath} |2^{S}| = \sum_{n=0}^{|S|} \sigma: \sigma \subseteq S \mbox{ and } |\sigma| = n \end{displaymath} \end{verbatim} And we would get this: \begin{displaymath} |2^{S}| = \sum_{n=0}^{|S|} \sigma: \sigma \subseteq S \mbox{ and } |\sigma| = n \end{displaymath} {\bfseries \large Procedure and Outputs} \LaTeX\ document creation is commonly done with an authoring environment such as TeXShop, texmaker, or WriteLaTeX (online). These tools show command buttons and options, and the source as it is typed along with the PDF (or other format) output. A sequence of text commands also performs the steps involved. \begin{enumerate} \item Write the file \texttt{aaaa.tex}. \item Run the program \texttt{latex} on the file:\\ \hspace*{1cm} \verb!> latex aaaa! \item Get the final form: \begin{description} \item[Preview] Run xdvi or ghostview to see the current image, for further development.\\ \hspace*{1cm} \verb!> xdvi aaaa!\\ Result: A preview window will pop up, showing the document. \item[Hardcopy] Run a print converter like dvips.\\ \hspace*{1cm} \verb!> dvips -o aaaa.ps aaaa!\\ Result: The file aaaa.ps will appear, suitable for a PostScript printer. \item[Web Page] Run LaTeX2HTML.\\ \hspace*{1cm} \verb!> latex2html aaaa!\\ Result: A website (HTML folder hierarchy) will be created, with figures as embedded images.\\ \emph{or}\\ \hspace*{1cm} Run TtH\\ \hspace*{1cm} \verb!> tth aaaa!\\ Result: A webpage will be created, with all source rendered as HTML, as well as possible. \item[PDF] Run pdflatex.\\ \hspace*{1cm} \verb!> pdflatex aaaa!\\ Result: A PDF document will be created. \end{description} \end{enumerate} \clearpage {\bfseries \large Document Structure} A \LaTeX\ document, in its source code form as a text file, has (1) a preamble, starting with \verb!\documentclass{...}!, which contains declarations but no content, and (2) a body, which is the content, between the commands \verb!\begin{document}! and \verb!\end{document}!. The file may include other components toward the end, either explicitly or through commands that produce them, such as an index or bibliography, and also other components at the beginning, such as a table of contents or a list of figures. \ \\ {\bfseries \large Full Documents} \emph{For Teaching} \begin{description} \item[Handout] Use document class \texttt{report} or \texttt{article} for greatest formatting flexibility; packages \texttt{fullpage} and \texttt{parskip} for narrow margins and paragraphs separated by line break. Examples included in this workshop: \texttt{CSquiz.tex}, \texttt{UnixHandout.tex}. \item[Exam] In addition to the standard formatting capabilities shown in the Quiz'' handout, such as vertical space and blank lines for answers, several exam packages are available (in CTAN). \item[Web Materials and other standard markup formats] In general, a document written with \LaTeX can be converted to HTML with a conversion program (above), for a web page or an EPUB. \end{description} \emph{For Research} \begin{description} \item[Thesis or Paper for Publication] Use document class \texttt{article} or \texttt{book}, for section and chapter numbering, table of contents, lists of figures, and other facilities. Bibliographies in the form of lists of references at the end of the paper are written by a separate program, Bib\TeX, and then appended in the next run of \texttt{latex}. Example for this workshop: The Robust'' paper example \texttt{RobustPaper.tex} has the separate bibliography file, \texttt{robust.bib} printed at the end. \item[Letter] Use document class \texttt{letter}; with \texttt{address}, \texttt{opening}, \texttt{closing}, and \texttt{signature} environments, several similar job-hunting letters can be generated. (Note: Various resume\'{e} and curriculum vitae styles are available in CTAN, as well.) \end{description} \ \\ {\bfseries \large Sources} CTAN, the Comprehensive \TeX Archive Network, is a consortium of institutions that provide everything you need, free for downloading. The low-level typesetting suite \TeX is the foundation on which \LaTeX\, a set of macros, runs; both are found at CTAN sites. Start at \texttt{http://www.tug.org}, the website of the \TeX Users Group. Contributed packages provide a wealth of special options. \clearpage {\bfseries \large Features} \begin{description} \item[Bibliographies and Indexes] The program Bib\TeX, using a bibliography file consisting of tagged text entries, will produce a list of references in a format of your choice. Indexes are generated with the \emph{MakeIndex} command. \item[Figures] Good control over floating figures, their captions, placement, and identifying references. \item[Notation] Vast pools of predefined symbols, from myriad disciplines, are available as commands. \item[Included Graphics] Diagrams, boxes, trees, and some graphs can be created right in the \texttt{picture} environment. Alternatively, embed as Encapsulated Postscript (or other form):\\ The key commands are: \begin{quote} \begin{verbatim} \usepackage{graphicx] \includegraphics{file.eps} \end{verbatim} The .eps'' file (Encapsulated PostScipt) can be produced by a graphics program such as Xfig, or by printing to a file using a PostScript printer definition, and adding a bounding box with a conversion program such as \texttt{ps2epsi}. \end{quote} \item[ASCII LaTeX] Some researchers exchange ideas via informal e-mail using \LaTeX\ notation to overcome the limitations of keyboard characters. The symbol S subscripted by a 1, for example, may be written \verb!S_1!,'' as it would be in math mode). \begin{quote} \begin{verbatim} You ask whether the i^{th} set is enumerable. But isn't S_{i} a subset of \sigma, which has cardinality \aleph_0? \end{verbatim} \end{quote} This meant to read as: \begin{quote} You ask whether the $i^{th}$ set is enumerable. But isn't $S_{i}$ a subset of $\sigma$, which has cardinality $\aleph_0$? \end{quote} \end{description} {\bfseries \large Features in Terms of Word Processing} The three ways to invoke typesetting are (1) \emph{commands}, which have the form \texttt{$\backslash$\emph{command}}, applied to the following text, or \texttt{$\backslash$\emph{command\{text\}}}, applied to the enclosed text, (2) \emph{declarations}, which have the form \texttt{\{$\backslash$\emph{declaration} ...\}} and apply to text enclosed in brackets, and (3) \emph{environments}, which enclose processed text in \texttt{$\backslash$begin\{\emph{environment}\}} and \texttt{$\backslash$end\{\emph{environment}\}}, possibly with other parameters. Here follows a list of the most rudimentary formatting choices familiar to users of word processors, and a sketch of how each might be accomplished in the typesetting system \LaTeX. \begin{description} \item[Fonts:] can be specified with a composition of the declarations \verb!\ttfamily! (for typewriter font), \verb!\bfseries! (for boldface), \verb!\sffamily! (for sans serif), or their command counterparts such as \verb!\texttt!, \verb!\textbf!, \verb!\textsf!; and size-changing commands such as \verb!\small!, \verb!\large!, and \verb!\Large!. So, for boldface, use either: \begin{quote} \hfill \verb!\textbf{...blah...}! \hfill or \hfill \verb!{\bfseries ...blah...}! \hfill \end{quote} \item[Margins:] are fixed normally at one inch on all four sides, but can be reset by changing the lengths \verb!\textwidth! and \verb!\textheight!, or through ontributed packages such as \texttt{fullpage} and \texttt{geometry}. \item[Headings, Footings, Page Numbers:] numbered and formatted automatically by the commands \verb!\chapter!, \verb!\section!, \verb!\subsection!, and choice of document class, and by the \verb!\pagestyle! command. \item[Lists:] available as environments \texttt{enumerate} (numbered), \texttt{itemize} (bulleted), and \texttt{description} (with item labels). \item[Indentation:] achieved with the \texttt{quote} environment or one of the list environments, or by declaring a list environment yourself. \end{description} \end{document}