%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ST 810A -- LATEX I, INTRODUCTION % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Slides 1-up -- for projecting % % For one-slide per page, uncomment the following: % \documentclass{seminar} \usepackage{psfig,shadow,epsf,sem-a4,fancybox,pstricks,amsthm,amssymb,amsmath} \usepackage{graphicx,psfrag,pst-node,subfigure} \slideframe{none} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Slides 2-up -- For handouts % % The following will print slides 2-up in landscape mode (side % by side rotated on the page. To get 2 slides per page, uncomment % the following: % % \documentclass[article,portrait]{seminar} % \usepackage{psfig,shadow,epsf,sem-a4,fancybox,pstricks,amsthm,amssymb,amsmath} % \usepackage{graphicx,psfrag,pst-node,subfigure} % \pagestyle{empty} % \slideframe{none} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Slides 4-up -- For handouts % % For slides 4 per page uncomment the following: % % \documentclass[article,portrait]{seminar} % \usepackage{psfig,shadow,epsf,sem-a4,fancybox,pstricks,amsthm,amssymb,amsmath} % \usepackage{graphicx,psfrag,pst-node,subfigure} % \twoup[1] % \pagestyle{empty} % \slideframe{none} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Alternatively, to print 4-up (or n-up) one can use the psnup % utility. For example, after creating the postscript file with one % slide per page, to get these slide 4-up with borders, use % % stat% add psutils % stat% psnup -nup 4 -r -d information.ps information_handout.ps % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % The following are some newcommands I have defined for making % boxes for headings, colors, etc. % % Makes a box around stuff \def\boxit#1{\vbox{\hrule\hbox{\vrule\kern3pt \vbox{\kern5pt#1\kern5pt}\kern3pt\vrule}\hrule}} \newcommand{\myheading}[1]{\begin{center}\shabox{ \bf #1} \end{center}} % Command so bullets aren't colored \newcommand{\citem}{\item $\mbox{}$} % Command to make colored bullets (red) \newcommand{\ritem}{\item {\red $\mbox{}$}} % defining colors: % \newgray{vlgray}{0.9} \newrgbcolor{lblue}{0.8 0.92 0.95} \newrgbcolor{lred}{1 0.8 0.8} \newrgbcolor{lyellow}{1 1 0.6} \newrgbcolor{orange}{1 0.7 0.2} \newrgbcolor{lgreen}{0.87 0.95 0.8} %\newrgbcolor{dgreen}{0.37 0.43 0.37} \newrgbcolor{dgreen}{0.36 0.75 0.41} \newrgbcolor{violet}{0.6 0.0 0.4} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This sets the height of the slide and can be changed % \setlength{\slideheight}{6.6in} % % This makes each slide start at the top rather than being centered % \centerslidesfalse % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %\rotateheaderstrue \begin{slide} \myheading{{\blue INTRODUCTION TO \LaTeX}} \begin{itemize} \ritem {\bf What is \LaTeX\,?} \ritem {\bf Basic usage and syntax} \ritem {\bf Modes and environments} \ritem {\bf Newcommands} \ritem {\bf Cross-referencing} \ritem {\bf Packages} \ritem {\bf Importing graphics} \ritem {\bf Tables and figures} \ritem {\bf Pictures} \ritem {\bf Where to learn more} \end{itemize} \end{slide} \begin{slide} \myheading{{\blue WHAT IS \LaTeX\,?}} {\bf \red What \LaTeX\, is NOT:} \begin{itemize} \ritem A {\sl \blue word-processor} that allows the user to view a document as it is created in a ``{\sl \blue what you see is what you get}'' format (e.g., MS-Word) \ritem A {\sl \blue word-processor} associated with a certain {\sl \blue operating system} (e.g., Windows) \ritem A {\sl \blue word-processor} in which creation of {\sl \blue highly technical mathematical content} is a big {\sl \blue pain in the neck} \ritem A product that the user must {\sl \blue purchase} \end{itemize} \end{slide} \begin{slide} {\bf \red What \LaTeX\, IS:} \begin{itemize} \ritem A {\sl \blue freely-available, powerful typesetting language} \ritem Supremely {\sl \blue well-suited} to creation of documents with {\sl \blue heavy technical and mathematical content} \ritem The standard typesetting language used by {\sl \blue major publishers of books} in the sciences (e.g., Springer, CRC Press, Wiley, etc.) \ritem The standard typesetting language used by most {\sl \blue journals} in the sciences (including {\it Journal of the American Statistical Association}, {\it Biometrics}, etc.) \ritem The popular way to produce a {\sl \blue dissertation} document in the preferred NCSU format (later\ldots) \end{itemize} \end{slide} \begin{slide} {\bf \red What \LaTeX\, IS:} \begin{itemize} \ritem Versions available for UNIX, Linux, Windows, etc. \ritem The {\sl \blue overwhelming choice} of most people in math, statistics, physics, computer science, engineering, and many other disciplines to produce articles, reports, books, letters, visual presentation materials, and more \end{itemize} \end{slide} \begin{slide} {\bf \red Basic premise:} \begin{itemize} \ritem A \LaTeX\, document must be {\sl \blue processed} in order for the final version of the document to be viewed \ritem The user creates a {\sl \blue file} with a {\tt .tex} extension that contains the text of the document and special {\sl \blue commands} that control \begin{itemize} \item style (e.g., article, letter, report) \item organization into sections, subsections, etc. \item mathematical content (e.g., equations, tables, symbols) \item incorporation of graphics \item automatic cross-referencing of equations, figures, tables, references \citem {\sl \blue And MUCH MORE!} \end{itemize} \ritem After the file is processed, the result may be {\sl \blue viewed} (using {\sl \blue freely available} software) and the file modified as necessary \ritem {\sl \blue Postscript} or {\sl \blue pdf} versions of the final document are easily created \end{itemize} \end{slide} \begin{slide} \myheading{{\blue BASIC USAGE AND SYNTAX}} {\bf \red Some basic steps for creating a document:} On a UNIX or Linux platform \begin{itemize} \ritem Create a {\tt .tex} file using any text editor (e.g., {\tt emacs}, {\tt Nedit}); the content should be {\sl \blue plain text} \ritem Run the file through the \LaTeX\, program to create a {\sl \blue device independent} ({\tt .dvi}) file containing the typesetting instructions (can be viewed with a {\tt .dvi} previewer) \ritem Run a program to convert the {\tt .dvi} file to a postscript file containing the {\sl \blue finished document}, which can be viewed with a postscript viewer or printed \ritem If desired, convert the postscript file to pdf format \ritem (Alternatively, a program called {\tt pdflatex} can be used to create pdf documents directly; this is not discussed here) \end{itemize} \end{slide} \begin{slide} {\bf \red For example:} The {\tt .tex} file used to create these slides is called {\tt latex1.tex} (available on the class web page) {\bf \red Commands used to process:} To create the {\tt .dvi} file and then a postscript file \begin{verbatim} stat% add tetex stat% latex latex1 stat% dvips latex1 stat% ghostview latex1.ps & \end{verbatim} \begin{itemize} \ritem {\tt add tetex} allows access on {\tt unity} to a comprehensive distribution of \LaTeX\, called {\tt tetex} (optional) \ritem Here, {\tt ghostview} is used to view the final document \ritem Using instead {\tt dvips -P pdf latex1} creates a postscript file that is optimal if the a pdf file is to be created, e.g., using acrobat distiller or the {\tt ps2pdf} utility \end{itemize} \begin{verbatim} stat% distill latex1.ps OR stat% ps2pdf latex1.ps \end{verbatim} \end{slide} \begin{slide} {\bf \red Structure of a {\tt .tex} file:} \begin{itemize} \ritem {\sl \blue Preamble} \begin{itemize} \item Specify {\sl \blue document class} (article, report, book, letter, etc.) \item Add any ``{\sl \blue packages}'' used (e.g., to import graphics, create headers and footers, etc.) \item Specify {\sl \blue margins}, {\sl \blue indentation}, {\sl \blue spacing}, etc. \item Define ``{\sl \blue new commands}'' (coming up\ldots) \end{itemize} \ritem {\sl \blue Document body} \begin{itemize} \item The actual document content \end{itemize} \end{itemize} {\bf \red Fun facts:} \begin{itemize} \ritem \% symbol is used to document the file or ``{\sl \blue comment out}'' text; anything to the right of a \% does not appear in the document \ritem \LaTeX\, commands start with \verb+\+ \ritem \LaTeX\, is {\sl \blue case sensitive} \end{itemize} \end{slide} \begin{slide} {\bf \red For example:} Here is a sample preamble and document body for an article (See the web page for a full template file) \begin{small} \addtolength{\baselineskip}{-1.5ex} \begin{verbatim} \documentclass[12pt]{article} % type size: also 10pt or 11pt % commands to set margins and spacing -- all have defaults \setlength{\textheight}{9in} % height of text on a page \setlength{\textwidth}{6.5in} % width of text on a page \setlength{\parskip}{2.3ex} % space between paragraphs % commands to invoke packages \usepackage{graphicx,psfig,epsf} % no limit to how many % user-defined newcommands \newcommand{\betahat}{\hat{\beta}} % more on this shortly % start of document body \begin{document} \section{Introduction} % sectioning command This is the introduction... \end{document} \end{verbatim} \addtolength{\baselineskip}{1.5ex} \end{small} \end{slide} \begin{slide} {\bf \red Syntax:} Some commands have arguments in braces \{\,\}, some do not {\bf \red Some commands with no argument:} \begin{verbatim} \ldots, \dag, \ddag, \%, \&, \#, \{ \}, \today, \LaTeX \end{verbatim} \ldots, \dag, \ddag, \%, \&, \#, \{ \}, \today, \LaTeX {\bf \red Commands with arguments:} \verb+\setlength{ ... }+, \verb+\section{ ... }+, \verb+\subsection{ ... }+, \verb+\hspace{ ... }+, \verb+\vspace{ ... }+ \end{slide} \begin{slide} \myheading{{\blue MODES AND ENVIRONMENTS}} {\bf \red Modes:} At any point in a \LaTeX\, file, there is a current ``{\sl \blue mode}'' in effect \begin{itemize} \ritem {\sl \blue Paragraph mode} -- the default text mode, with line wrap. A space between lines signals the start of a new paragraph \ritem {\sl \blue Math mode} -- math symbols and commands may be used, and mathematical expressions result \ritem {\sl \blue LR mode} -- ``left-to-right'' mode, lines do not automatically wrap around \end{itemize} {\bf \red Note on math mode:} Math symbols and commands only work in math mode; if they are used in other modes, an {\sl \blue error} will result \end{slide} \begin{slide} {\bf \red Environments:} Often, there is also an {\sl \blue environment} in effect that determines how material is displayed -- the basic structure is \begin{verbatim} \begin{environment-name} ... \end{environment-name} \end{verbatim} {\bf \red For example:} The {\tt math} environment \begin{verbatim} the linear model \begin{math}Y = X\beta + \epsilon\end{math}. \end{verbatim} the linear model $Y = X\beta + \epsilon$. \begin{itemize} \ritem The popular shortcuts are to use \verb+$ ... $+ or \verb+\( ... \)+, e.g. \end{itemize} \begin{verbatim} the linear model $Y = X\beta + \epsilon$. \end{verbatim} \end{slide} \begin{slide} {\bf \red For example:} Creating a numbered list \begin{verbatim} \begin{enumerate} \item This is the first entry \item This is the second entry \item This is the third entry \end{enumerate} \end{verbatim} \begin{enumerate} \item This is the first entry \item This is the second entry \item This is the third entry \end{enumerate} \end{slide} \begin{slide} {\bf \red Some popular environments:} \begin{tabular}{lll} Environment & Mode & Description \\*[-0.05in] \hline {\tt math} & math & in-text mathematical expressions \\*[-0.05in] {\tt displaymath} & math & displayed mathematical expressions \\*[-0.05in] {\tt equation} & math & displayed expressions w/ line number \\*[-0.05in] {\tt eqnarray} & math & lines up equal signs, line numbers \\*[-0.05in] {\tt eqnarray*} & math & lines up equal signs, no line numbers \\*[-0.05in] {\tt array} & math & matrices and arrays \\*[-0.05in] \hline {\tt itemize} & paragraph & list with bullets \\*[-0.05in] {\tt enumerate} & paragraph & list with numbers \\*[-0.05in] {\tt description} & paragraph & list with indentation \\*[-0.05in] \hline {\tt tabular} & LR & align text in columns \\*[-0.05in] {\tt table} & paragraph & number and position table \\*[-0.05in] {\tt figure} & paragraph & number and position figure \\*[-0.05in] \hline {\tt center} & paragraph & center text \\*[-0.05in] {\tt mbox} & LR & write text while in math mode \\*[-0.05in] \end{tabular} \end{slide} \begin{slide} {\bf \red Math:} \LaTeX\, is {\sl \blue tailor-made} for writing involving high mathematical content! And it's easy! \begin{itemize} \ritem {\sl \blue Subscripts, superscripts, roots} \begin{verbatim} e^y, x_{ij}, \sqrt{x+y}, \sum^n_{i=1} \end{verbatim} $e^y, x_{ij}, \sqrt{x+y}, \sum^n_{i=1}$ \ritem {\sl \blue Greek} \begin{verbatim} \alpha,\beta,\gamma,\delta,\epsilon,\eta,\theta,\lambda \end{verbatim} $\alpha,\beta,\gamma,\delta,\epsilon,\eta,\theta,\lambda$ \begin{verbatim} \Gamma,\Delta,\Theta,\Lambda,\Omega,\Sigma \end{verbatim} $\Gamma,\Delta,\Theta,\Lambda,\Omega,\Sigma$ \ritem {\sl \blue Roofs} \begin{verbatim} \hat{\alpha},\tilde{\alpha},\dot{x},\overline{x},\bar{x} \end{verbatim} $\hat{\alpha},\tilde{\alpha},\dot{x},\overline{x},\bar{x}$ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} \begin{itemize} \ritem {\sl \blue Binary operations} \begin{verbatim} \pm,\times,\div,\cup,\otimes \end{verbatim} $\pm,\times,\div,\cup,\otimes$ \ritem {\sl \blue Relation symbols} \begin{verbatim} \leq,\subset,\in,\geq,\equiv,\sim,\approx,\neq,\perp \end{verbatim} $\leq,\subset,\in,\geq,\equiv,\sim,\approx,\neq,\perp$ \ritem {\sl \blue Arrows} \begin{verbatim} \rightarrow,\Leftarrow,\Leftrightarrow,\uparrow \end{verbatim} $\rightarrow,\Leftarrow,\Leftrightarrow,\uparrow$ \ritem {\sl \blue Miscellaneous} \begin{verbatim} \forall,\exists,\Re,\sum,\prod,\int \end{verbatim} $\forall,\exists,\Re,\sum,\prod,\int$ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} {\tt textstyle} vs. {\tt displaystyle} \begin{itemize} \ritem Math {\sl \blue displayed} as equations may be carried out using the {\tt displaymath}, {\tt equation}, {\tt eqnarray*}, {\tt eqnarray} environments \ritem {\sl \blue Shortcuts} when equations are {\sl \blue not numbered}: \verb+$$ ... $$+ or \verb+\[ ... \]+; e.g., \begin{verbatim} $$\sum^n_{i=1} x_i^2 (Y_{ij}-z_i \beta)$$ \end{verbatim} $$\sum^n_{i=1} x_i^2 (Y_{ij}-z_i \beta)$$ \ritem Some symbols appear {\sl \blue differently} depending on whether they are in the text or displayed; e.g., \begin{verbatim} $\sum^n_{i=1}$ VS. $$\sum^n_{i=1}$$ \end{verbatim} $\sum^n_{i=1}\hspace{0.1in}\mbox{\tt VS.}\hspace{0.1in} \displaystyle{\sum^n_{i=1}}$ \ritem Can be {\sl \blue overridden} with \verb+textstyle{ }+ and \verb+\displaystyle{ }+ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} \begin{itemize} \ritem {\sl\blue Products, integrals, unions} \begin{verbatim} $$\prod^n_{j=1},\hspace{0.1in} \int^\infty_t f(u) du, \hspace{0.1in}\bigcup_{A: A \in \Omega}$$ \end{verbatim} $$\prod^n_{j=1},\hspace{0.1in} \int^\infty_t f(u) du, \hspace{0.1in} \bigcup_{A: A \in \Omega}$$ \ritem {\sl \blue Special functions} \begin{verbatim} $\exp(x), \log y, \sin(k\pi), \min_x f(x)$ \end{verbatim} $\exp(x), \log y, \sin(k\pi), \min_x f(x)$ \ritem Fractions, partial derivatives \begin{verbatim} $$\frac{\exp(x^T \beta)}{1+\exp(x^T \beta)}, \frac{\partial u}{\partial x}$$ \end{verbatim} $$\frac{\exp(x^T \beta)}{1+\exp(x^T \beta)}, \frac{\partial u}{\partial x}$$ \end{itemize} {\bf \red Note:} Use \verb+\displaystyle+ for fractions; otherwise they are too small \end{slide} \begin{slide} {\bf \red Math, continued:} There are different ways to present math in {\bf boldface}; here are two \begin{itemize} \ritem \verb+$\mbox{\boldmath $X$}$, $\mbox{\boldmath $\Sigma$}$+ \\ $\mbox{\boldmath $X$}$, $\mbox{\boldmath $\Sigma$}$ \ritem \verb+$\mathbf{X}$, $\mathbf{\Sigma}$+ \\ $\mathbf{X}$, $\mathbf{\Sigma}$ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} {\tt array} and {\tt eqnarray} environments \begin{itemize} \ritem $(2 \times 3)$ {\sl \blue matrix}: \begin{verbatim} \left( \begin{array}{ccc} x_{11} & x_{12} & x_{13}\\ x_{21} & x_{22} & x_{23} \end{array} \right) \end{verbatim} $$\left( \begin{array}{ccc} x_{11} & x_{12} & x_{13} \\ x_{21} & x_{22} & x_{23} \end{array} \right)$$ \ritem {\sl \blue Determinant} of $(2 \times 2)$ matrix: \begin{verbatim} \left| \begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array} \right| \end{verbatim} $$\left| \begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array} \right|$$ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} {\tt array} and {\tt eqnarray} environments \begin{itemize} \ritem {\sl \blue Braces} \begin{verbatim} x = \left\{ \begin{array}{l} \sin x \mbox{ if } y<3, \\ \cos x \mbox{ if } y \geq 3 \end{array} \right. \end{verbatim} $$ x = \left\{ \begin{array}{l} \sin x \mbox{ if } y<3, \\ \cos x \mbox{ if } y \geq 3 \end{array} \right.$$ \ritem {\sl \blue Binomial coefficients}: \verb+\left( \begin{array}{c}N \\ y \end{array} \right)+ $$\left( \begin{array}{c}N \\ y \end{array} \right)$$ \end{itemize} \end{slide} \begin{slide} {\bf \red Math, continued:} {\tt array} and {\tt eqnarray} environments \begin{itemize} \ritem {\sl \blue Equation with several lines, = signs lined up} \end{itemize} \begin{verbatim} \begin{eqnarray*} \Delta_i & = & \sum_j \sum_{k \neq j} \mbox{Corr}(Y_{ij},Y_{ik}) \\ & = & \sum_j \sum_{k \neq j} \rho_i^{\parallel j-k \parallel} \\ & = & \frac{2 \rho_i}{1-\rho_i} \left\{ n_i-1 - \frac{\rho_i(1-\rho_i^{n_i-1})}{1-\rho_i} \right\} \end{eqnarray*} \end{verbatim} \begin{eqnarray*} \Delta_i & = & \sum_j \sum_{k \neq j} \mbox{Corr}(Y_{ij},Y_{ik}) \\ & = & \sum_j \sum_{k \neq j} \rho_i^{\parallel j-k \parallel} \\ & = & \frac{2 \rho_i}{1-\rho_i} \left\{ n_i-1 - \frac{\rho_i(1-\rho_i^{n_i-1})}{1-\rho_i} \right\} \end{eqnarray*} \end{slide} \begin{slide} {\bf \red The {\tt tabular} environment:} \begin{itemize} \ritem As with {\tt array}, separate {\sl \blue elements} with \&, make {\sl \blue new line} with \verb+\\+ \ritem Specify {\sl \blue number of columns} and type of {\sl \blue justification} at top, add {\sl \blue vertical} and {\sl \blue horizontal} lines \end{itemize} \begin{small} \begin{verbatim} \begin{tabular}{c|rr} & \multicolumn{2}{c}{Results} \\ Parameter & \multicolumn{1}{c}{Bias} & \multicolumn{1}{c}{SE} \\ \hline $\beta_0$ & $-$0.030 & 0.12 \\ $\beta_1$ & 0.002 & 0.07 \end{tabular} \end{verbatim} \end{small} \begin{tabular}{c|rr} & \multicolumn{2}{c}{Results} \\ Parameter & \multicolumn{1}{c}{Bias} & \multicolumn{1}{c}{SE} \\ \hline $\beta_0$ & $-$0.030 & 0.12 \\ $\beta_1$ & 0.002 & 0.07 \end{tabular} \end{slide} \newcommand{\bbeta}{\mbox{\boldmath $\beta$}} \newcommand{\betahatj}{\widehat{\bbeta}_j} \newcommand{\var}{\mbox{var}} \newcommand{\sumjn}{\sum^n_{j=1}} \begin{slide} \myheading{{\blue NEWCOMMANDS}} {\bf \red Motivation:} In technical typing, the same (nasty) expression may appear {\sl \blue frequently} \begin{itemize} \ritem A {\tt newcommand} is like a ``{\sl \blue shortcut}'' to produce the expression easily \ritem \verb+\newcommand{keyword}{text}+ \ritem A {\tt newcommand} declaration may appear {\sl \blue anywhere} in a \LaTeX\, source file (preamble or body) and is defined thereafter \ritem A {\tt newcommand} {\tt keyword} may {\sl \blue not} contain numbers \end{itemize} \end{slide} \begin{slide} {\bf \red Examples:} Some {\tt newcommand} definitions and their usage \begin{verbatim} \newcommand{\bbeta}{\mbox{\boldmath $\beta$}} \newcommand{\betahatj}{\widehat{\bbeta}_j} \newcommand{\var}{\mbox{var}} \newcommand{\sumjn}{\sum^n_{j=1}} \end{verbatim} \begin{itemize} \ritem Note that a {\sl \blue previously-defined} {\tt newcommand} may be used in defining a {\sl \blue new} {\tt newcommand} \end{itemize} \begin{verbatim} $$\sumjn \var(\betahatj)$$ \end{verbatim} $$\sumjn \var(\betahatj)$$ \end{slide} \begin{slide} \myheading{{\blue CROSS REFERENCES}} {\bf \red Advantage:} A {\sl \blue built-in} feature of \LaTeX\, is that it {\sl \blue automatically} keeps track of sections, numbered equations, pages, and so on \begin{itemize} \ritem Sections, equations, tables, figures, pages etc. may be {\sl \blue labeled} and referred to by the label \ritem If new labeled entities are added, \LaTeX\, {\sl \blue renumbers} them automatically \ritem It is even possible to generate a {\sl \blue table of contents} and {\sl \blue index} for a document \ritem To set up cross references correctly, must process a document {\sl \blue twice} \end{itemize} \begin{small} \hspace*{-0.5in}\verb+LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.+ \end{small} \end{slide} \begin{slide} {\bf \red Examples:} \begin{itemize} \ritem Numbered equation \begin{verbatim} \begin{equation} \var(\alpha) = \sumjn \var(\betahatj) \label{eq:alpha} \end{equation} In equation~\ref{eq:alpha}, we see that... \end{verbatim} \end{itemize} \end{slide} \begin{slide} {\bf \red Examples, continued:} \begin{itemize} \ritem Section label \begin{verbatim} \section{Introduction} \label{s:intro} ...As discussed in Section~\ref{s:intro}, kurtosis... \end{verbatim} \ritem Page label \begin{verbatim} Thus, we see that calculation of the variance is straightforward \label{p:var} ...On page~\pageref{p:var}, the variance calculation... \end{verbatim} \end{itemize} \end{slide} \begin{slide} \myheading{{\blue PACKAGES}} {\bf \red Useful utilities:} \LaTeX\, is much more {\sl \blue powerful} than the intrinsic features would suggest \begin{itemize} \ritem A {\sl \blue huge} user community \ritem Contributed {\sl \blue document classes}, ``{\sl \blue add-ons}'' to allow different capabilities and customization \ritem ``{\sl \blue Packages}'' \ritem Define new commands, syntax, etc. \ritem Visit {\tt CTAN} (see slide~\pageref{slide:ref}) \end{itemize} \end{slide} \begin{slide} {\bf \red Example:} {\tt fancyheadings.sty} -- make ``{\sl \blue fancy}'' document {\sl \blue headers} and {\sl \blue footers} \begin{itemize} \ritem In preamble \begin{verbatim} \usepackage{fancyheadings} \lhead{\footnotesize \bf CHAPTER \thesection} \rhead{\footnotesize \bf ST 762, M. DAVIDIAN} \cfoot{\footnotesize PAGE \rm\thepage} \end{verbatim} \ritem See {\tt http://www.stat.ncsu.edu/$\sim$st762\_info/} for results \end{itemize} \end{slide} \begin{slide} {\bf \red Example:} {\tt shadow.sty} -- make ``{\sl \blue shadowboxes}'' \begin{itemize} \ritem In preamble \begin{verbatim} \usepackage{shadow} \shabox{This stuff} \end{verbatim} \shabox{This stuff} \end{itemize} {\bf \red In addition:} There are also user-defined, alternative {\sl \blue document classes} \begin{itemize} \ritem {\sl \blue Journals}, {\sl \blue book publishers} may have their own class to create articles, pages with a specific format \end{itemize} \end{slide} \begin{slide} {\bf \red Dissertations:} At NCSU, dissertations may be created in \LaTeX\, using special a special style; to learn more, visit \begin{small} \begin{verbatim} http://www2.acs.ncsu.edu/grad/ETD/tutorial/latex.htm http://www.stat.ncsu.edu/computing/howto/latex/session_2/session2.html \end{verbatim} \end{small} \end{slide} \begin{slide} \myheading{{\blue IMPORTING GRAPHICS}} {\bf \red Numerous options:} We discuss three of these \begin{itemize} \ritem {\tt psfig} -- \verb+\usepackage{psfig}+ \begin{verbatim} \psfig{figure=dental.ps,height=2.5in} \end{verbatim} \end{itemize} \end{slide} \begin{slide} \psfig{figure=dental.ps,height=2.5in} \end{slide} \begin{slide} \begin{itemize} \ritem {\tt epsf} -- \verb+\usepackage{epsf}+ \begin{verbatim} \epsfysize=2.5in \epsfbox{dental.ps} \end{verbatim} \end{itemize} \end{slide} \begin{slide} \epsfysize=2.5in \epsfbox{dental.ps} \end{slide} \begin{slide} \begin{itemize} \ritem {\tt graphicx} -- \verb+\usepackage{graphicx}+ \ritem Can also import other formats (pdf, jpg, etc) \begin{verbatim} \includegraphics[height=2.5in]{dental.ps} \end{verbatim} \end{itemize} \end{slide} \begin{slide} \includegraphics[height=2.5in]{dental.ps} \end{slide} \begin{slide} \myheading{{\blue TABLES AND FIGURES}} {\bf \red Two standard \LaTeX\, environments:} {\tt table} and {\tt figure} \begin{itemize} \ritem Automatically {\sl \blue numbers} tables and figures \ritem Allow tables and figures to be formatted and {\sl \blue referenced} within a document \ritem Allow {\sl \blue captions} \end{itemize} \end{slide} \begin{slide} \begin{small} \begin{verbatim} \begin{table} \begin{center} \begin{tabular}{c|rr} & \multicolumn{2}{c}{Results} \\ Parameter & \multicolumn{1}{c}{Bias} & \multicolumn{1}{c}{SE} \\ \hline $\beta_0$ & 0.030 & 0.12 \\ $\beta_1$ & 0.002 & 0.07 \end{tabular} \end{center} \caption{\it Results of the simulation>} \label{t:simresults} \end{table} \end{verbatim} \end{small} \end{slide} \begin{slide} \begin{table} \begin{center} \begin{tabular}{c|rr} & \multicolumn{2}{c}{Results} \\ Parameter & \multicolumn{1}{c}{Bias} & \multicolumn{1}{c}{SE} \\ \hline $\beta_0$ & 0.030 & 0.12 \\ $\beta_1$ & 0.002 & 0.07 \end{tabular} \end{center} \caption{\it Results of the simulation.} \label{t:simresults} \end{table} \begin{itemize} \ritem Reference -- \verb+In Table~\ref{t:simresults}, we see that...+ \ritem In Table~\ref{t:simresults}, we see that\ldots \end{itemize} \end{slide} \begin{slide} \begin{verbatim} \begin{figure} \caption{\it The dental data of Pothoff and Roy.} \label{f:dental} \begin{center} \includegraphics[height=2.5in]{dental.ps} \end{center} \end{figure} \end{verbatim} \end{slide} \begin{slide} \begin{figure} \caption{\it The dental data of Pothoff and Roy.} \label{f:dental} \begin{center} \includegraphics[height=2.5in]{dental.ps} \end{center} \end{figure} \end{slide} \begin{slide} {\bf \red Useful package:} {\tt subfigure} -- \verb+\usepackage{subfigure}+ \begin{itemize} \ritem Create a ``{\sl \blue multipanel}'' figure from several files with each panel labeled \end{itemize} \begin{small} \begin{verbatim} \begin{figure} \centering \subfigure[]{ \includegraphics[width=1.5in]{dental.ps}} \hspace*{0.1in} \subfigure[]{ \includegraphics[width=1.5in]{dental.ps}} \caption{(a) The dental data of Pothoff and Roy. (b) The dental data of Pothoff and Roy, again.} \label{f:dental2} \end{figure} \end{verbatim} \end{small} \end{slide} \begin{slide} \begin{figure} \centering \subfigure[]{ \includegraphics[width=1.5in]{dental.ps}} \hspace*{0.1in} \subfigure[]{ \includegraphics[width=1.5in]{dental.ps}} \caption{(a) The dental data of Pothoff and Roy. (b) The dental data of Pothoff and Roy, again.} \label{f:dental2} \end{figure} \end{slide} \begin{slide} \myheading{{\blue PICTURES}} {\bf \red \LaTeX\ can ``draw'':} \begin{itemize} \item {\tt picture} environment \item The following is a {\sl \blue simple} picture -- circles, curves, ovals, etc are also possible (see the documentation) \end{itemize} \end{slide} \begin{slide} {\bf \red Two-compartment open model with IV administration:} \vspace{0.5in} \begin{center} \setlength{\unitlength}{1in} \begin{picture}(5,1) \put(0.5,0.5){\framebox(1.5,1){$C(t)$}} \put(2,1.25){\vector(1,0){0.5}} \put(2.25,1.35){\makebox(0,0){$k_{12}$}} \put(2.5,0.75){\vector(-1,0){0.5}} \put(2.25,0.85){\makebox(0,0){$k_{21}$}} \put(2.5,0.5){\framebox(1.5,1){$C_{tis}(t)$}} \put(0.25,1){\makebox(0,0){$D:$}} \put(1.25,0.5){\vector(0,-1){0.3}} \put(1.35,0.35){\makebox(0,0){$k_{e}$}} \end{picture} \begin{eqnarray*} \frac{dC(t)}{dt} = k_{21}C_{tis}(t)-k_{12}C(t)-k_{e}C(t),\\ \frac{C_{tis}(t)}{dt}=k_{12}C(t)-k_{21}C_{tis}(t),\mbox{ } C_{tis}(0)=0 \end{eqnarray*} \end{center} \end{slide} \begin{slide} {\bf \red Picture was made with:} \begin{verbatim} \setlength{\unitlength}{1in} \begin{picture}(5,1) \put(0.5,0.5){\framebox(1.5,1){$C(t)$}} \put(2,1.25){\vector(1,0){0.5}} \put(2.25,1.35){\makebox(0,0){$k_{12}$}} \put(2.5,0.75){\vector(-1,0){0.5}} \put(2.25,0.85){\makebox(0,0){$k_{21}$}} \put(2.5,0.5){\framebox(1.5,1){$C_{tis}(t)$}} \put(0.25,1){\makebox(0,0){$D:$}} \put(1.25,0.5){\vector(0,-1){0.3}} \put(1.35,0.35){\makebox(0,0){$k_{e}$}} \end{picture} \end{center} \end{verbatim} \end{slide} \begin{slide} {\bf \red Other ``drawing'' resources:} \begin{itemize} \ritem The {\tt pstricks} package -- really {\sl \blue intricate stuff} like grids, plots of functions, etc (see class web page for link to documentation) \ritem {\tt xfig} \end{itemize} \end{slide} \begin{slide} \myheading{{\blue WHERE TO LEARN MORE}} {\bf \red Books and guides:} \begin{itemize} \ritem Lamport, L. (1994) {\it \LaTeX: A Documentation Preparation System, User's Guide and Reference Manual} (The creator of \LaTeX\,) \ritem Goossens, M. et al. (1994) {\it The \LaTeX\, Companion} \ritem Kopka, H. (1999) {\it A Guide to \LaTeX\,: Document Preparation for Beginners \& Advanced Users} \ritem Hahn, J. (1993) {\it \LaTeX\, for Everyone: A Reference Guide and Tutorial for Typesetting Documents Using a Computer} \ritem Oetiker, T. et al. (2002) {\it The Not So Short Introduction to \\ \LaTeX\ $2_{\displaystyle{\varepsilon}}$} ({\sl \blue Available on the class web page}) \end{itemize} \end{slide} \begin{slide} \label{slide:ref} {\bf \red Resources online and on the Web:} \begin{itemize} \ritem The {\sl \blue Comprehensive \TeX\, Archive Network} (CTAN) {\tt http://www.ctan.org} -- a repository of tons of style files, packages, etc. \ritem Several {\sl \blue free} guides available on {\tt unity} at {\tt \small /afs/bp.ncsu.edu/contrib/tetex107/share/texmf/doc/latex/general} (as {\tt .dvi} or {\tt .ps} files) \ritem Local intro tutorial {\tt http://www.stat.ncsu.edu/computing/howto/latex/session\_1/} \end{itemize} \end{slide} \end{document}