LaTeX Began as TeX, in 1982 (Knuth). Purely a typesetting tool. LaTeX added macros, maintaining TeX as it s typesetting engine (Lamport). Now maintained by Frank Mittlebach. For an interesting interview, see: http://www.freesoftwaremagazine.com/articles/mittelbach_interview
Typesetting We are accustomed to What You See Is What You Get (WYSIWYG) tools such as this Powerpoint presentation. WYSIWYG seldom results in an aesthetically pleasing publication.
Advantages (from http://www.ctan.org/tex- archive/info/lshort/english/lshort.pdf) Professionally crafted layouts are available, which make a document really look as if printed. The typesetting of mathematical formulae is supported in a convenient way. Users only need to learn a few easy-to-understand commands that specify the logical structure of a document. They almost never need to tinker with the actual layout of the document. Even complex structures such as footnotes, references, table of contents, and bibliographies can be generated easily.
Advantages (from http://www.ctan.org/tex- archive/info/lshort/english/lshort.pdf) Free add-on packages exist for many typographical tasks not directly supported by basic LaTeX. For example, packages are available to include PostScript t graphics or to typeset t bibliographies conforming to exact standards. Many of these add-on packages are described in The LaTeX Companion. LaTeX encourages authors to write well-structured texts, because this is how LaTeX works by specifying structure. TeX, the formatting engine of LaTeX2e, is highly portable and free. Therefore the system runs on almost any hardware platform available.
Disadvantages (from http://www.ctan.org/tex- archive/info/lshort/english/lshort.pdf) LaTeX does not work well for people who have sold their souls... Although some parameters can be adjusted within a predefined document layout, the design of a whole new layout is difficult and takes a lot of time. It is very hard to write unstructured and disorganized documents. Your hamster might, despite some encouraging first steps, never be able to fully grasp the concept of Logical Markup. (From another source: There are two major classes of text markup: logical and physical. Logical markup indicates the role of a text segment, such as being more important than normal text or being a citation. Physical markup is an instruction to present text t in a particular a manner, such as using a font of some specific kind or underlining. )
Howtostart start Need LaTeX available for your system. Input: an ASCII file. Output: t an aesthetically ti pleasing typeset document. Components of a LaTeX input file: Preamble, including a specification of the document class (or type), specification of non-default document settings (margins, etc.), requests for inclusion i of other nonstandard d packages (must be available locally). Document body.
Mathematics and Example Statistics Input \documentclass{article} \usepackage{graphics} \setlength{\oddsidemargin}{0in} \setlength{\textwidth}{6.0in} \setlength{\textheight}{10in} \setlength{\topmargin}{-0.5in} \begin{document} \setlength{\parindent}{0in} \setlength{\parskip}{2ex} \begin{center} {\bf \Large STAT 6550 -- SPRING 2014 Homework 1 \vspace{2ex} \normalsize Due Tuesday February 4th} \end{center} \raggedright \vspace{2ex} \begin{enumerate} \item Obtain documentation for \LaTeX\ -- select something that you can use as a fairly comprehensive desk reference. Specify in your homework write-up what you have selected and why.
Example Input (continued) Mathematics and Statistics \item Obtain and install \LaTeX\ on your own computer, or identify another point of access to \LaTeX\ (e.g., in a student computing lab). Briefly describe where you will use \LaTeX, including the machine, platform, the front-end (editing) program, and where you obtained the source code for installation (if you installed \LaTeX\ yourself). \item Turn in a solution for the following problem: Suppose that $X \sim \mathrm{binomial}(n,p)$. {\bf (a)} Show that the maximum likelihood estimator (MLE) of $p$ is $\hat{p}=x/n$. {\bf (b)} Show that the MLE attains the Cramer-Rao lower bound. {\bf (c)} If $n=10$ and $X=5$, plot the log likelihood function. Use software to obtain this plot, and include the plot in the body of your solution. \end{enumerate} \end{document}
Example Output Mathematics and Statistics
LaTeX Resources TeX Users Group (TUG) http://www.tug.org Comprehensive TeX Archive Network http://www.ctan.org MiKTeX (TeX for Windows) http://www.miktex.org WinEdt (commercial front-end interface for editing TeX documents in Windows) http://www.winedt.com
LaTeX Resources (continued) Free documentation: The Not So Short Introduction to LaTeX2e http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf t /t hi /i /l h t/ li h/l h t More free documentation: A Gentle Introduction More free documentation: A Gentle Introduction http://ctan.tug.org/tex-archive/info/gentle/gentle.pdf
Creating a Document Specify the document class (with options). Specify settings. Begin document. Include text. End document. Running the document through TeX (without errors) yields a.dvi file, which must be viewed in some sort of dvi window.
Some basic types : The Document Class Article (far and away the most common what I use 99.9% of the time). Book Slides (for presentations) Letter
Settings Before beginning the document, specify parameters corresponding to: Margins Page size Size of text body Header and footer locations Information about titles, dates, etc. (See the handout regarding parameters for page settings.)
Characters in the Input File Upper and lowercase letters, and the ten digits (recall that in ASCII, the letter O is distinguishable from the digit zero 0. Sixteen punctuation characters:. : ;,?! ` ( ) [ ] - / * @ Ten special characters (used only in LaTeX commands): # $ % & ~ _ ^ \ { } The characters + = < > are used mainly in math formulas, although + and = can be used in regular text.
Special Environments/Tools: Displayed Text Quotes: \begin{quote} and \end{quote}. Descriptive lists (like glossaries): \begin{description} and \end{description}. Each item is specified using the \item[name] Description here. Lists (like bullet items): \begin{list} and \end{list}. Each item prefixed with \item. Lists can be nested. Numbered lists: \begin{enumerate} and \end{enumerate}. Each item prefixed with \item.
Math Example This following text (imbedded in a document) results in the output shown on the following page. The bootstrap p-value is obtained by resampling from the reference set, $\Gamma$, of all $2 \times 4$ tables with column sums equal to 10. Under $H_{0}$ the probability of observing any $\xb \in \Gamma$ is \begin{equation} f_{\pi}(\xb) = \prod_{j=1}^{4} {4} {10 \choose x_{j}}\pi {j}}\pi^{x_{j}}{j}} (1 - \pi)^{10- x_{j}} \, \label{eq:binexact} \end{equation} a product of four binomial probabilities. It is not possible to resample tables From $\Gamma$ with probabilities given by (\ref{eq:binexact}) because $\pi$, the Bernoulli probability i under $H_{0}$, $ is unknown. We can, however, replace $\pi$ with \[ \hat{\pi} = \frac{5}{40} \, \] the maximum likelihood estimate (mle) under the null hypothesis. The bootstrap p-value is then evaluated by resampling tables from $\Gamma$ with probabilities given by \begin{equation} f_{\hat{\pi}}(\xb_{j}) {j}) = \prod_{j=1}^{4} {10 \choose x_{j}}\hat{\pi}^{x_{j}} (1 - \hat{\pi})^{10-x_{j}} \. \label{eq:binboot} \end{equation}
Math Example: Result
Special Environments/Tools: Tables Delimited with \begin{tabular} and \end{tabular}. Number of columns is specified up-front, with argument to. For example, \begin{tabular}[lcr] b specifies that we will have three columns: the first left-justified, the second centered, and the third right-justified. Within each row, columns are separated by the & symbol. A row is completed by using the command \\ for a new line.
This: Tables Example \begin{tabular}{ l ccc c }\hline \multicolumn{5}{ c }{Stratum 1: Women using O.C. Aged 25-29} \\ \hline & \multicolumn{3}{ c }{Cigarettes Smoked (per day)} & \\ \cline{2-4} \multicolumn{1}{ c }{Disease Status} & \multicolumn{1}{ c}{none} & \multicolumn{1}{c}{1to 24} & \multicolumn{1}{c }{more than 24} & \multicolumn{1}{c }{Total} \\ \hline M.I. & 0 & 1 & 3 & 4 \\ Control & 25 & 25 & 12 & 62 \\ \hline \end{tabular} produces this:
Special Environments/Tools: Pictures and Graphics Particularly in scientific documents, inclusion of plots or charts is generally required. A graphics package is required, included at the beginning of the document with something like \include{graphics} (this package is included with generally all versions, although system-dependent variations exist it allows inclusion of postscript and encapsulated postscript files). To include a plot at some point in the document, one might use something like \includegraphics[options]{filename here}. } The picture environment (delimited with \begin{picture} and \end{picture}) allow one to draw shapes in the document.
Special Environments/Tools: Bibliography Requires a database file of citations, formatted in a special way: @ARTICLE{CMS, AUTHOR = "Corcoran, C. and Mehta, C. and Senchaudhuri, P.", TITLE = "Power Comparisons for Tests of Trend in Dose-Response Studies", JOURNAL = "Statistics in Medicine", VOLUME = "19", PAGES = "3037-3050", YEAR = "2000" } Given this.bib file, one can easily include citations in the text t via the \cite{cms} command. Must follow a series of steps to achieve proper formatting. Wide variety of journal-specific styles are available.