Figures, tables and seminars
Tables
Tables and figures are examples of entities that 'float'. They generally form too large an entity to be conveniently placed just anywhere on a page. Instead LaTeX waits so that it can put them in a convenient place: the top of a page, the bottom of a page, or on a page by itself.
To request LaTeX to include a table use the table environment:
\begin{table}
\caption{...}
\label{...}
...
instructions for typesetting the table
(usually tabular within a center environment)
...
\end{table} See the table of fractal dimensions at the end of Src/fractals31.tex. In the first run through, LaTeX cannot find room on page 5 for the table, and so places it on page 6 by itself. In the second run, the Table of Contents has pushed more material into the document, and now the table is placed at the top of the page.
One may include a List of Tables in the document with the command \listoftables.
Figures
The usual way to include a figure in LaTeX is as follows.
- Create a postscript file of the drawing from whatever application is being used to generate the figure. For example, Src/cantor.m and Src/koch.m are Matlab programs that create graphs which have postscript in files Src/cantor.eps and Src/koch.eps
- However, pdfLaTeX does not support postscript graphics! In order to seamlessly be able to use pdfLaTeX or ordinary LaTeX, and produce a quality graphic, convert to pdf using the public domain ps2pdf program (so you have two copies of the graphics file, an .eps file and a .pdf file). For example, the two files Src/cantor.pdf and Src/koch.pdf
- Then place in the preamble the commands
\usepackage{graphicx} - Somewhere near where you want the figure, include the figure environment
\begin{figure} \centering \includegraphics{...} \caption{...} \label{...} \end{figure}where the argument of the \includegraphics command is the filename (without the extension). - Or use this to scale the picture up/down to the width of the page
\begin{figure} \centering \includegraphics[width=0.9\textwidth]{...} \caption{...} \label{...} \end{figure}
See the two figures in Src/fractals32.tex
The width=0.9\textwidth scales the figure to 90%of the width of the typeset text: change it if desired; leave it out in order to reproduce the figures unscaled.
Note: I strongly urge you to generate the graphics at about the same size as they are to appear. This is so that the title, label and legend information is actually readable and the line thicknesses are creditable.
One may include a List of Figures in the document with the command \listoffigures.
Packages
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 full or brief TeX Catalogue Online for instance.Useful packages are color, hyperref, showkeys and url.
Make your own style
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 hyperref and color packages, so include
\usepackage{color} \usepackage[colorlinks]{hyperref} - Also we always want page headings, but detest the "all capitals" style that is the default, so very naughtily crunch the \MakeUppercase command
\pagestyle{headings} \renewcommand{\MakeUppercase}[1]{\color{green}\textsf{#1}}so that the page headings now appear an attractive green and sans serif font (actually I prefer the X11 colour OliveGreen). - Say we would like the title to always appear in sans serif font and be magenta in colour (although I prefer Brown). We interfere with LaTeX using the \let command which defines a pointer to the current definition of another command; thus
\let\LaTeXtitle\title
defines \LaTeXtitle to point to the original LaTeX definition of \title. Follow this with\renewcommand{\title}[1]{\LaTeXtitle{\color{magenta}\textsf{#1}}}to define a new version of \title that colours it magenta and 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
\renewcommand{\abstractname}{\color{blue}Abstract}But to get all section headings blue we need to know (by delving into the file latex.ltx) that all section headings are typeset via the command \@startsection. Thus put into your style file the commands\let\LaTeX@startsection\@startsection \renewcommand{\@startsection}[6]{\LaTeX@startsection% {#1}{#2}{#3}{#4}{#5}{\color{blue}\raggedright #6}}See that this makes the sixth argument to the real \@startsection blue and also raggedright; the sixth argument is the section title. (Note: the "@" character acts as a letter in a .sty file, but not in any .tex file!)
Download the above in Src/mystyle.sty (with a few enhancements) and try it yourself with Src/fractals32.tex. (There is the possibility of a glitch in the colouring if a section heading appears at the top of a page.)
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 (as for all of the 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 extension definitions should go into a mydefns.sty file.
Seminar style
"Three rules of public speaking: Be forthright. Be brief. Be seated."
(S. Dressel & J. Chew, 1987)
There is a nifty documentclass for preparing overhead transparencies or computer presentations, the seminar class. Within this class, you use all the normal typesetting facilities offered by LaTeX. (There are many other packages, often looking much flashier, but I consider the alternatives are more awkward to learn to use.)
An example framework is:
\documentclass[a4]{seminar}
...
\begin{document}
\begin{slide}
...
\newslide
...
\newslide
...
\end{slide}
\end{document} Note the use of slide environment within the document, and the use of the \newslide command to strongly control page breaks as it is important to control the specific material on each page.
Such a document is to be viewed and printed in landscape mode, see Src/fractals33.tex.
It is good practise to:
- have less information per page, the rule is no more than 6 lines of 6 words per line, in which case I suggest including the 12pt option in the documentclass;
- typeset slides in a sans serif font, here done by including the command \def\everyslide{\sf} in the preamble, as in
\documentclass[a4,12pt]{seminar} \def\everyslide{\sf} - in the seminar style it is often the vertical height that is the constraint in graphics so scale with height=0.8\textheight if needed.