Packages, styles, and seminars


See video discussion 51

There are packages to extend LaTeX in zillions of ways: some excellent, some flaky. When you want to do something, the chances are someone has wanted to do it before and has written a package to do it. See the vast "List of Packages" in the TeX Catalogue Online (initiated by Graham Williams).

Useful packages are amsmath, color, hyperref, showkeys, enumitem, cleveref, url and pgfplots.

If you use pdfLaTeX and have the package, then always \usepackage{microtype}. The microtype package does some fine adjustments that turns the great typesetting of default LaTeX into near perfect typesetting.

Command definitions

One can define commands that extend LaTeX. For example, in mathematics (see the mathematics section) we might define partial derivative commands
    {\frac{\partial #2}{\partial #1}}
    {\frac{\partial^2 #2}{\partial #1^2}}
The first two have two arguments, the [2]. Within a definition, #n denotes a placeholder for the nth supplied argument to the command. The last, with one argument, redefines the \vec command to denote vectors by boldface characters (rather than have an arrow accent). Then for example
  \vec\nabla\times\vec q
  =\vec i\left(\D yw-\D zv\right)
  +\vec j\left(\D zu-\D xw\right)
  +\vec k\left(\D xv-\D yu\right).
more simply typesets \[ \newcommand{\D}[2]{\frac{\partial #2}{\partial #1}} \renewcommand{\vec}[1]{\mathbf{#1}} \vec\nabla\times\vec q =\vec i\left(\D yw-\D zv\right) +\vec j\left(\D zu-\D xw\right) +\vec k\left(\D xv-\D yu\right). \]

Students, and markers, want the numbering of sections to suit the exercise numbers of assignments. For example, when an assignment is composed of Exercises 35.1, 35.2, and 42.1, redefine the section numbering by


This empowers us to start each successive exercise with simply the logical \section{}. If desired, then include explanatory text in the exercise title with \section{explanatory text}.

You will have noticed that LaTeX is very verbose. Some people define their own abbreviations for the common command structures so that they are quicker to type. Do not do this; it makes your LaTeX much less portable and harder to read. Instead,

  • setup your editor to cater for the verbosity;
  • use command definitions only to
    • give you new logical patterns, such as the partial differentiation, or
    • if justifiable, redefine typeset appearance, such as for vectors.

Make your own style

See video discussion 52

Create a file, say mystyle.sty, and include in it commands to change the appearance of your documents. Then include in the preamble of all your documents \usepackage{mystyle}. But what do you put in your style file? Here are some suggestions.

  • By default use the microtype, hyperref and color packages, so include

  • Also we always want page headings, but the default "all capitals" style is known to be poor, so very naughtily crunch the \MakeUppercase command
    so that the page headings now appear green and in sans serif font (I prefer the X11 colour OliveGreen, see colour information).

  • Say we would like the title information to always appear in sans serif font (but always remember that "I like" is dangerous). We interfere with LaTeX using the \let command which defines a pointer to the current definition of another command; thus
    defines \LTXmaketitle to point to the original LaTeX definition of \maketitle. Follow this with
    to define a new version of \maketitle that puts it into a sans serif font. Neat!

  • Now let us make all section headings blue. The abstract is easy we just redefine its name
    But to get all section headings blue we need to know (by delving into the LaTeX system file latex.ltx wherever it may be on your computer) that all section headings are typeset via the command \@startsection. Thus put into your style file the commands
      {#5}{\color{blue}\raggedright #6}} 
    See that this makes the sixth argument to the original \@startsection blue and also raggedright; the sixth argument is the section title.

    The "@" character acts as a letter in a .sty file, but not in any .tex file!

Download the above in mystyle.sty (with a few enhancements) and try it yourself with Src/fractals32.tex (recall you also need the graphics Src/cantor.pdf and Src/koch.pdf).

Is it a style? or an extension?

The test of whether a definition should go into your style file is determined by the answer to this question: will your LaTeX document still typeset without error if your style file is not used?
  • if the answer is yes, then include the definition in a style file (as for all of the immediate above);
  • if the answer is no (as for \D and \DD defined earlier), then you are extending the functionality of LaTeX and it is not suitable for a style file in the true sense. Instead such extending definitions should go into a separate definitions file, say mydefns.sty.
That is, maintain two types of 'style' file:
  • a file of definitions that extend the logic and functionality of LaTeX---a file that you must share with collaborators and journals;
  • a style file in the true sense that only affects the appearance of resultant documents by changing the way commands and environments translate logical LaTeX into physical appearance---keep this to yourself as it only reflects your own personal peccadilloes.

Work with publisher styles and classes

Most publishers and conference proceedings have their own LaTeX style and class files that they want/require you to use. Almost all of them are a least a decade or so out of date. So avoid using them until you know your submission is accepted.

When your submission is accepted, then (supposedly) you do have to work with the publisher's style/class file, as well as with the advanced LaTeX you have coded. These often conflict. Here I describe one example scenario.

One conflict is that most publishers define environments for theorems and similar. But to use cleveref you must define such theorem-like environments after \usepackage{cleveref}. To do so you often naughtily need to tell LaTeX to 'forget' what the publisher has defined. In such a scenario use \let and \relax as in the following.

  • In the preamble, after using the publishers style/class file, code
    This 'undefines' theorem, corollary, ... and the counter c@theorem by pointing them to the special 'empty' command \relax.
  • Then continue with your cleveref and \newtheorems.
Other conflict scenarios might be handled similarly.

However, be warned that commercial publishers often simply send accepted manuscripts to India to be completely re-typeset afresh: that is, whatever beautiful LaTeX you have coded and supplied is completely ignored! :(


Using packages, and making your own, is the way to employ the hard work of many people around the world. Remember: if you want to do something out of the ordinary, then someone else probably has a package to do it.

Seminar style

See video discussion 53

Three rules of public speaking: Be forthright. Be brief. Be seated. (S. Dressel & J. Chew, 1987)

To prepare a document for overhead projecting, there are two viable extremes (as well as possibilities in between):

  • the documentclass beamer produces a visual kaleidoscope to delight the presenter of a talk;
  • alternatively, use standard LaTeX to easily produce a clean looking document to project for your audience.
beamer is the method many people choose, perhaps from this example template. But there are two problems with beamer:
  • you have to learn and use many new commands unique to beamer, commands that you never use elsewhere; and
  • the source code is so specific to beamer that you cannot practically use the source for any other purpose either.
If you really want to invest significant time in learning beamer, then go for it. But I do not recommend it. Instead, here I next describe the simpler alternative of using standard flexible LaTeX to produce good quality clean slides to project.

In either case, remember that many conference venues have flat floors and relatively low screens so that the bottom quarter--third of every one of your slides will be obscured for most of your audience! Be prepared: e.g., avoid beamer styles that waste the top quarter of a slide in `navigation'.

Alternatively use standard LaTeX

Simply use the geometry package to typeset onto landscape 'paper', which is reasonable for most modern projectors of aspect ratio 16:9, with

The above is for newer projectors: if you know you will have an old projector, aspect ratio 4:3, then change paperheight=96mm.

Also force some page-breaks to suit how you want to present (I do not normally allow forcing page-breaks, but a talk presented by you is very different to a document read by others). Use the \newpage command where needed. Perhaps require all sections to automatically start on a new page with


Such a document is to be viewed and printed in landscape mode, see Src/fractals33.tex. Of course, one would not present this material: for a talk supported by projection prefer summary sentences, typically typeset in the itemize environment.

As always, it is good practise to:

  • have less information per page, the usual rule is no more than six lines of six words per line, the 12pt option in the documentclass helps;
  • in the 'landscape' mode of projected slides it is often the vertical height that is the constraint in graphics so, if needed, then perhaps scale with height=0.8\textheight;
  • put citation information into a footnote on the relevant page;
  • the last slide is your Conclusions, not a meaningless "Thank You" slide, nor a bibliography.