Q: How do I get bold math in foils?
  • For math symbols in the running text, you can use bm{} command.


    ...$bm{y_{ij}}$ is the response... The bm macro is different from the mathbf command in that it emboldens everything including symbols.
  • For math symbols in the equation or eqnarray environment, use a pair of environments: begin{boldequation} formula end{boldequation} begin{boldequation*} formula end{boldequation*} The unstarred form has automatic referencing and is numbered, while the starred form has no automatic referencing and numbering.
Q: How to have double-spacing effect in LaTeX?


\usepackage{setspace} \doublespacing

to the preamble. The whole document will be double-spaced including bibliography. Footnotes, figures, and tables will still be single-spaced. If you want a part of the text still be single-spaced, include the part in the environment:

\begin{singlespace} \end{singlespace}

If you want to have other spacing effect for a part of the text, you can use the environment:


. For example, to reduce the linespacing in the bibliography and table of contents, you can use the following command

\begin{spacing}{0.9} \tableofcontents \end{spacing} ... \begin{spacing}{0.9} \bibliographystyle{plain} \bibliography{refs} \end{spacing}

The other two commands provided by the


package are




You can also change the other spacing by using the \setstretch command, e.g. \setstretch{1.8}. To get single-spaced, one-and-half-spaced, and doublespaced effects, you can also use \setstretch{1}, \setstretch{1.5} and \setstretch{2} respectively.

Q: I am behide the times, what is new LaTeX2e?

LaTeX2e Information

OnLine Documentation About:

  • LaTeX2e Local Guide
  • Additional LaTeX2e Documents

(in PostScript):

  • UBC Statistics Dissertation Document Class
  • LaTeX2e WWW links

UBC Thesis Style Format

  • Located under /opt/texmf/bin/Thesis
  • Just copy the 4 files in that directory

(and fill in the blanks!!)

  • Carefully read the thesis.tex file

LaTeX2e Local Guide

  • local.ps (a local guide to use of LaTeX2e on the departmental research network)

Additional LaTeX documentation in .ps format

  • Introduction to LaTeX2e
    • essential.ps: a short introduction to the most important commands
    • usrguide.ps: overview on the new commands relative to LaTeX 2.09
  • Graphics
    • grfguide.ps: macros for including postscript images, color and much more. This file is created by running LaTeX on grfguide.tex and dvips grfguide.
  • Tools
    • afterpage.ps: causes the commands specified in its argument to be expanded after the current page is output.
    • array.ps: A new implementation of LaTex's tabular and array environment.
    • dcolumn.ps: This package defines a system for defining column of entries in an array or tablular which are to be aligned on a ``decimal point''.
    • delarry.ps: implicits \left \right pairs.
    • enumerate.ps: gives the enumerate environment an optional argrument which determines the style in which the counter is printed.
    • fileerr.ps: deal with ``File not found error''.
    • ftnright.ps: Footnotes in a multi-column layout.
    • hhline.ps: produces a line like \hline, or a double line like\hline\hline except for its interaction with vertical lines.
    • indentfirst.ps: makes the first line of all sections ec, be indented by the usual paragraph indentation.
    • layout.ps: displays page layout variables.
    • longtable.ps: defines the longtable environment, a multi-page version of tabular.
    • multicol.ps: improved typesetting in several columns
    • rawfonts.ps: provides emulation of LaTex 2.09 documents which used low-level commands such as \tenrm.
    • showkeys.ps: displays the internal labels with \ref, \cite etc.
    • somedefs.ps: allows package writers to provide options which switch definitions on and off.
    • tabularx.ps: a new environment which takes the same argument as tabular, but modifies the width of certain columns, rather than the inter column space, to set a table with the requested total width.
    • theorem.ps: an extension of the LaTex theorem environment.
    • varioref.ps: similar to \ref but adds an additional page references, like `` on the facing page'' or ``on page 27'' whenever the corresponding \lable is not on the same page.
    • verbatim.ps: reimplements the LaTeX verbatim and verbatim* environments.
    • xr.ps: implements a system for external references.
    • xspace.ps: saves the user from having to type \ or {} after most occurrences of a macro name in text.
  • Advanced topics
    • clsguide.ps: LaTeX2e for class and package writers
    • fntguide.ps: the New Font Selection Scheme for class and package writers
    • cfgguide.ps: configuration options for LaTeX2e

UBC Statistics Dissertation Document Classes

Q: How to change the distance between the title and the authors in the title page in foils?

Use vspace command in the author command. Example:

leftheader{textsc{Presentation using textsc{pdf}LaTeX, and FoilTeX, class}} %make a left header %rightheader{textsf{thepage}} %make a right header MyLogo{Eugenia and Weiliang, UBC Stats} %make a left footer %rightfooter{} %make a right footer title{shadowbox{Presentation using textsc{pdf}LaTeX, and FoilTeX, class}} % the document title % the author author{vspace{2cm}\r Latex Smart \r 6356 Agricultural Road\r University of British Columbia\r Vancouver BC \r V6T 1Z2} % the date date{today} begin{document} thispagestyle{empty} setcounter{page}{0} maketitle
Q: How to change the frame style of the slides in the "seminar" class?
A1) Method 1:
      a) first include "usepackage{fancybox}"
      b) then use
           slideframe{shadow} or
           slideframe{double} or
           slideframe{oval} or
         to change frame style or use
         to create slides without frame
     note: put these commands in the preamble will cause all slides have 
the same frame unless you use another slideframe command to change it.
The above commands can be used within any begin{slide}...end{slide}.

  Method 2:
    a) first include "usepackage{semcolor}"
    b) then use
      slideframe{scplain} or
      slideframe{scshadow} or
      slideframe{scdouble} or
Q: Several BibTeX style files for Stats magazines

Here . Rated as "very useful" by Weiliang. Problem is that some journals require bibliographic references in one's paper to be exactly as they want. This collection can help you to solve this problem much faster.

Q: How to let the cited references have the form "authors (year)" instead of "[1]" say?

You can use the package "natbib". The following is an example:

usepackage[super, sort]{natbib}
bibpunct{(}{)}{;}{a}{,}{,} % required for natbib


Use the natbib package with options texttt{super} and texttt{sort}, 
and use verb+citep+ or verb+citet+
instead of the command verb+cite+. In detail, we need to include the 
natbib package
and include the line

bibliographystyle[super, sort]{natbib}

in the preamble. 

And use the bibliographstyle texttt{plainnat}, i.e.

The command
verb+citet+ is for ``last name (year)'' and verb+citep+ for 
``(last name, year)'' which will be shown in the text.

The result of verb+citep{GoossensEtAl:1999}+ is citep{GoossensEtAl:1999}.
The result of verb+citetcitet{GoossensEtAl:1999}+ is citet{GoossensEtAl:1999}.

bibliographystyle{plainnat} % required for natbib


The content of the file "


" is below:

  author="{Goossens, M.} and {Rahtz, S.} with {Gurari, E., M.} and {Moore, R.} and {Sutor, R.  S.}",
  title="The LaTeX, Web Companion",

You can copy the above two files to your computer and compile them to see the



Q: How do you make a PDF document from a TeX/LaTeX formatted file?

To make PDF documents from a TeX or LaTeX source, use one of these commands:

         pdftex file.tex  ... or ...      pdflatex file.tex 

substituting file.tex for the filename of your TeX/LaTeX sources. The output ought to be be in

Q: Using pdflatex/pdftex/dvipdfm as part of teTex

Below are ways to get from TeX/LaTeX to a pdf file. These approaches are highly recommended over the use of ps2pdf, which does a bitmap conversion (resulting in a huge pdf file that is not searchable by words).

Converting latex: pdflatex without graphics

Just run pdflatex.

back to top

Converting latex: pdflatex with graphics

To include figures in latex, the "best" approach is with the graphicx package:




Then figures are included with something like



   \includegraphics[width=3in, height=4in]{plot}
   \includegraphics[width=7.5cm, height=10cm]{plot}

The use of \totalheight or \totalwidth is preferable in order that text characters are proportional and not squished in one direction.

Just run pdflatex or latex. For the above, pdflatex assumes a file plot.pdf exists, and latex assumes a file plot.ps exists

back to top

Converting figures as ps files to pdf: ps2pdf, epstopdf

To convert a figure from postscript (ps file) to pdf, use the ps2pdf command. If this fails, then try epstopdf. This conversion is needed to include graphics for pdflatex. In pdflatex, graphics types allowed are pdf and png, but not ps.

back to top

Converting dvi to pdf: dvipdfm

dvipdfm is currently only available on the Linux computers, not the Solaris computers.

dvipdfm converts a dvi file directly to pdf, without changes in the TeX/LaTeX file. The resulting file is searchable. Different graphics type (eg., jpeg, gif) can be used with the graphicx package in LaTeX; these cannot be seen with xdvi but they can be seen from acroread after the dvi file is converted to pdf.

Sometimes dvipdfm works better than pdflatex (e.g., slides using the 'seminar' style).

Q: Common TeX/laTex errors

This is a list of common TeX/LaTeX errors that I see when reviewing manuscripts. Also some shortcuts are given to make math equations more readable (and easier to edit).

Note the \def (or \newcommand) should appear at the beginning of your tex file (before \begin{document} in LaTeX).

  • If you look carefully at math writing, variables are printed in the italics or slanted font. However something like the exp or log function is not a variable, so it is in standard font, even within math mode. That is, \exp, \log, \sin etc are used for math and trigonometric functions. For statistics, \Pr is a definition for probability of an event, but \E for expectation and \Var for variance, etc, are not defined.

    However, you can define these yourself with something like

         \def\Var{\mathop{\rm Var}} 


         \def\Var{{\rm Var}\,}
         \def\E{{\rm E}\,}

    The first version does not work well for E.

  • Math expressions with subscripts and superscripts should also be put in math mode, e.g., $a$, $x=1$, $-1$. In non-math mode, - is a hyphen (shorter than minus sign, -- is an en dash (e.g. for pp. 34--43), and --- is an em dash — for use in a middle of a sentence.
  • Unless you are in displayed math mode, fractions should usually be expressed with a solidus, for example $x_i/n$ and not $\frac{x_i}{n}$ or ${x_i\over n}$.
  • Use a definition for any math symbol with a 'hat', 'bar', 'tilde' etc. This will make equations easier to read in TeX. Same thing for symbols for equal in distribution, convergence in probability, etc. Examples are:
        \def\phat{{\hat p}} 
        \def\Fbar{{\overline F}}
        \def\eqd{\,{\buildrel d \over =}\,} 
  • boldface Greek in scriptsize: LaTeX may not automatically resize a symbol when it is a subscript of superscript. Hence def are needed for scriptsize characters, e.g.
      \def\thbf{\mbox{\boldmath $\theta$}
      \def\thbfs{\mbox{\scriptsize \boldmath $\theta$}}
      $$f(\thbf) =2^{\thbfs}$$

    Alternatively, use the ams packages amsmath and amssymb

  • labelling of equations, and theorems, lemmas, corollary: 
    To get the section number to appear in an equation, add (to the beginning):

    and add


    at the beginning of each section.

    To get Theorems, Lemmas, Corollaries to be on the same numbering scheme, by section, add:

  • larger brackets[], braces{}, parentheses(): these should be used around summations, fractions etc. It is simplest to use \left[, \right] etc, but left and right only work if your equation is not split into more than one line. In the latter case, use one of \bigl, \Bigl, \bbigl, \Biggl (and corresponding \bigr on the right).

    Sometimes one needs a larger '/' or '|'. For '/', use \bigm, \Bigm etc. For '|', use \bigl, \bigm, \bigr etc depending on whether it is left, middle or right.