cPbL's LaTeX page

I have advice on (now more than) five things here (and a specific page on Economics elsewhere):


If you are writing a thesis or a scientific paper and you do not know what LaTeX is, I wish you to break out of your Microsoft-imposed matrix dream and try some software that was built to work well rather than to make money.  The top-level place to start or to finish seeking TeX-related material is the CTAN. For introductory material, choose "search" and see the bottom of the page.  Most of the software described in this document is available through the CTAN, and many references will be made to it.  To get LaTeX running on your system, you will want to get both LaTeX (or MikTeX on Windows 9?/NT) and ghostscript software, and you will likely want to use Emacs or LyX.  These are all free.  A lot of (La)TeX documentation is online, but you will find that for details these resources will all refer to two paper books which are the classic bibles: "LaTeX" by Leslie Lamport, and "The Latex Companion" by Goossens, Mittelbach, and Samarin. A newer, and reportedly even better, bible is the guide by Kopka and Daly.

An update [2006]: I now use the LyX interfact to LaTeX nearly exclusively. I am also facing another dissertation, and may be able to do it most of the way this time in a recent version of LyX.

Feel free to ask me questions on material below; I haven't written everything here. Also feel free to send me an email if something was especially useful.

Stanford University Thesis style

Many universities provide LaTeX style files to fulfill their thesis requirements.  You can find Stanford's yourself.  In 1999 it was at CSLI's site. The version of suthesis-2e.sty which I have was last updated in September 1995; it is extremely useful. 

One bug exists with the suthesis-2e style as of 2001. That is that if you make a 2-sided printout and the preface ends on an odd page, an extra blank page is needed and missing. Hugh Holbrook (Stanford) provides the following solution, which is implemented in my copy (old?) of suthesis-2e.sty:

Add the three lines
denoted with '+' below to the afterpreface macro in suthesis-2e.sty to
force a clearpage at the end of the preface.

+ \if@twoside
+ \cleardoublepage
+ \fi

What I have to offer is help on modifying the font size of the chapter and section headings from this style, as they are large and ugly.  As I write my thesis, I am keeping style changes in cpbl.sty.

From this, you can see how to adjust the look of these headings, as well as several other key modifications / fixes to the standard software. So, the beginning and end bits of my thesis looks as shown below. Note: there are many things listed here, but they are mostly commented out, and the indexing stuff (and more) can be eliminated. My thesis is available on my home page in pdf, hyperlinked pdf, and HTML versions, so you can see whether you like what I got.

\documentclass[11pt,openright,twoside]{report} % draft 
%\documentclass[10pt,draft]{report} % draft, twoside,openright
\usepackage[dvips]{graphicx} % Standard. Inclusion of .eps graphics
%\usepackage[pdftex]{graphicx} % Standard. Inclusion of .pdf graphics
\usepackage{makeidx} % Standard. Indices
% Note on Index: I find that Emacs justifies a paragraph, it inserts extra
% space in multi-word index entries which are line-wrapped. This
% causes multiple entries when using makeindex. Solution is to clean
% up after Emacs! Terrible.
% I prefer the first paragraph of each section to be indented, which is not the LaTeX default (see the Companion, p. 28)
\usepackage{indentfirst} % Standard
\usepackage{afterpage} % Standard utility. Used here for
% \afterpage{\clearpage}. Actually, not used. (?)
%\usepackage{float} % Included in MiKTeX. Allows ``H'' specifier for floats.
%\restylefloat{table} % See page 150 of the companion. This if or float package.
\usepackage{suthesis-2e} % Stanford Thesis style
% Change the font size of chapter and section headings, define fig style etc:
\usepackage{cpbl} %Most of my customizations stored here with comments
%\usepackage[light]{draftcopy} % Turn this on for drafts, but Yap
% won't work.
% Don't use the following. If you want different margins, use vpage package!
%\usepackage{cpblMIT} % Drafthead doesn't work in this, but it sets
% margins
% CHOOSE SECTION NUMBERING DEPTH ( erase this section: not needed)
% Default is that everything down to subsection gets numbered. Below
% lines can change this.
%\addtocounter{secnumdepth}{1} % Number even the subsubsections.
%\addtocounter{tocdepth}{1} % And also show the subsub's in the TableOfContents
\usepackage[square]{natbib}% From CTAN. Used with a huge variety of .bst biblio formats
\citeindextrue % Automatically put reference authors in the index!!!!!!!
\usepackage[small,bf]{caption2}% This is caption2, supported from
% CTAN. Customize caption width, font, etc.
\setlength{\captionmargin}{20 pt}
\usepackage{amssymb}% Include extra symbols: \gtrsim and \lesssim
% Load xspace package, useful for defining shortcut commands
%\usepackage{index} This is a David Jones package which I haven't
% got. See the companion for info.
%\setstretch{1} % Remove this line for non-draft

% Adjust behaviour of float placement (see LaTeX companion)
% using float package.



%\newcommand{\draftComment}[1]{ {\tiny #1} } % For drafts
\newcommand{\draftComment}[1]{} % For non-drafts

\renewcommand{\text}[1]{{{\rm #1}}} % For use within math mode.

\newcommand{\Index}[1]{#1\index{#1}} % Shorthand. See Companion, p352
\newcommand{\Sindex}[2]{#1\index{#1#2}} % Shorthand. See Companion, p352
\newcommand{\nn}[1]{#1n} % Used to denote that a index ref is in a footnote.

\input{preface} % Load all the data that serves the suthesis-2e style.
% Even the following doesn't work:
\newpage{\pagestyle{empty}\cleardoublepage} % See companion, page 93. This doesn't work, and if the preface ends on an odd page and you're printing 2-sided, you may have to print the preface separately from the body...


This work describes optical measurements of high altitude discharges

\chapter{Conclusions and Suggestions}


The major results of this work may be grouped as follows.

\section{Further Research}

\newpage\cleardoublepage \addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{aguCpbl} }

\newpage\cleardoublepage \addcontentsline{toc}{chapter}{Index}

Please see the bibliography section below for an explanation of the last item. This can make life very pleasant! Above, I use the caption2 package, version 1999-Oct-9. All you need is caption2.sty and two documentation files, caption2.dvi and caption.dvi. The preface.tex file which is included above, looks like this:
\title{\sc Fast Photometric Imaging of High Altitude Optical Flashes Above Thunderstorms}
\author{Christopher Paul Barrington-Leigh}
\dept{Applied Physics}
\principaladvisor{Umran S. Inan}
\firstreader{Sebastian Doniach}
\secondreader{Martin Walt}
\submitdate{September 2000}


\dedication{To the god of fire.}


Lightning in the Earth's troposphere is among the largest impulsive


How can I adequately thank everyone who has made the past five years
the most fun period of my life?

\tablespagefalse % change to \tablespagetrue if you have tables

[Added May 2001; brief:] Please see the hyperlinked PDF version of my thesis, mentioned above. This is incredibly easy to make, since LaTeX inherently knows about cross-references. Just use the pdflatex program rather than latex to compile your code, and use the PDF compilation options, above and in cpbl.sty, and invoke the hyperref package, as above. Make sure to upgrade to the very latest version before you use this. [I should mention that I have run into a "! TeX capacity exceeded, sorry [pool size=68177]. ...after \ifx \csname br@\x \endcsname" problem running in one implementation, but not in another.] However, some problems are that the colorlinks option of hyperref conflicts with the doublespace package (I have fixed this -- contact me!) and that you will have to have all your .eps figures available as .pdf files. The latter is solved easily with the clever Perl script epstopdf; in Unix I use a C-shell script makePDF.csh to convert all my figures using this program. Other methods of making PDF figures or PDF documents have caused me great and varied frustrations.

Writing papers for AGU journals

This is straight from the CTAN, and new for late 1999.  If you are tired of using the archaic American Geophysical Union (AGU) style files, get AGUplus from CTAN.  Without all the documentation, the core is aguplus.cls.  It is self-documented.

LaTeX Bibliography

I have found it baffling how many people (in my group and discipline) have tried to reinvent the wheel, or, more often, not to use one, when it comes to bibliographies.  Everything you can imagine has already been written very nicely by someone else.  Having said that, here are: (1) a piece of software to extract bibliographic data from INSPEC, written by Dave Lauben from my group at Stanford; (2) a new possibility for generating BiBTeX data directly from literature searches for free; and (3) the agu.bst format and natbib.sty style from CTAN, both written by Patrick Daly.

I never need to enter any bibliographics information by hand.  Here is the process I have been going through:

  1. Periodically search INSPEC, which is available for Stanford students from library.stanford.edu, for any publications since 1968 that are of interest.  When you have sought some references (e.g. "find abstract sprites") you can export your findings into a format which we can convert to a .bib file.  (I  believe this format is also used by EndNote, and thus I suspect that bibliographic databases analogous to Inspec for other fields could also export into this format. If not, you will need to modify a Perl program below.)  For instance, I use
  2. mail all export to cpblnova
    to send the search results to myself in the EXPORT format (and then save the text file as "inspec.txt" from my email inbox) or better, if I'm using SAMSON (a Stanford telnet program), I can just type
    save all export to c:/inspec.txt
    to save it to disk on a p.c.
  3. Next, run a modified version of Dave Lauben's program, to be run on Unix.  His package includes export2bib which calls cit2let2bib.pl, and I run it like this:
  4. export2bib inspec.txt > sprites.bib
    This produces a file in standard format (see Lamport's "LaTeX", section B.1) which can be read by BibTeX.  Not standard is the algorithm for choosing a keyword associated with each reference.  You could change that easily by editing the cit2let2bib.pl file.  I am using a key such as InanApr99 for a work published by Inan (and others) in April of 1999.
  5. To make use of this bibliography database, I now include the line
  6. \usepackage{natbib} % From CTAN.  Used in association with a huge variety of .bst bibliography formats.
    in the preamble of my LaTeX file and at the end of the document write:
    \bibliography{sprites,elves} % Include references in sprites.bib, elves.bib
    \bibliographystyle{aguCpbl}      % Use the brilliant author-year referencing system of agu.bst
    The latest versions of the natbib.sty package and agu.bst package are available from CTAN. Without all the documentation, etc, all you need is natbib.sty and agu.bst.   However, as you can see in the \bibliographystyle line above, I use aguCpbl.bst, in which I have made a small modification so that it doesn't de-capitalize title words. Now when I need to reference a source, I can use one of the varieties of the \cite command documented in agu.bst to make a reference mid-sentence, at the end of a sentence, in a list, or whatever (honestly -- any formulation I could need!), and to automatically add the item to the printed bibliography.  If there are references with identical author/year designations, they will automatically have a, b, c, etc appended to the designations.
Note [Feb 2000]: There is now a vastly easier way to create BibTeX databases.  This will likely make the Perl programs (steps 1 and 2, above) obselete, but at the moment there are a few limitations to this new service. Axiom provides free INSPEC literature searches AND will output up to 200 of them at a time in BibTeX format!  However, the citation keys are essentially random numbers, so you have to go through and provide them yourself.  Since the information included in the records is limited, it may be difficult to automate this to match the format described above.
Presumably with time, the option of exporting searches to BibTeX format will become increasingly ubiquitous.

VLF Group Bibliography Database

If you are working in the VLF group at Stanford, please help to create a group resource if you find yourself spending time making bibliographies.  If running Perl scripts is an imposition, just use the latest version of the group bibliography files, which I will maintain while I'm here, at http://nova.stanford.edu/~vlf/bibliography, and if have something to add to it, please don't keep the change to yourself!

There are only two important issues for creating and maintaining such a database. One is the format of the citation key. I have decided that Dave Lauben's method of FirstauthorMonthYear (e.g. SmithApr99) is the best alternative. This could be made YnK-compliant. The second is how to organise and update the various database (.bib) files. This is still an open question. The good thing is that they can be multiply redundant when listed (see above) in a \bibliography command. So feel free to suggest new subjects for .bib files... I will be happy to do the INSPEC search and conversion if you can't.

Please help contribute something, and suggest changes. There are a number of things that need working on.

Composing a poster

This is sort of obvious, but if you have material that is already in LaTeX format and you can print out to a large printer (or else use software like Adobe Illustrator to tile a large document onto the printable areas of many pages -- also easy), then it would be silly to use anything other than the a0poster LaTeX class for the job. Get the most up-to-date version of it from CTAN, and you can find instructions in English by searching the web. You can use the A0 format in either landscape or portrait orientation. We still need to make a sample document in English (they're in German so far) for each of these to make life really easy. (I may do this, or tell me if you've done it). And to top it off, you can install the PSUtils package (search the web!) on your system and use its "psresize" command to make a one-page version of your poster for proofing and handouts. For instance, to make a one-page version of my portrait A0 poster, I used:
psresize -H46.78in -W33.05in -pletter bigposter.ps onepage.ps
in North America, or
psresize -H46.78in -W33.05in -pA4 bigposter.ps onepage.ps

Composing "slides" for digital or overhead projection

There's nothing clever here; this seems to be a matter of style, and everyone puts up their favourite style file for slides. I started using "slides" in 2005 and use LyX with foils.cls and its built-in LyX style, augmented with my own cpblFoils.sty (achieves first item below, along with some modest header / footer info; ask me for it), in order to satisfy most of my requirements:

So, to use it in LyX: Under document layout, set document class to "foiltex", options to "dvips,headrule,color", and pagestyle to "foilheadings", and under document paper, choose "landscape". Under document preamble, enter:

\usepackage[cspex,bbgreekl]{mathbbol} % Eek! This is necessary for expect %mathbb symbol in foils...?!
See my Software page, for the moment, for more details.

December 1999 [Jan 2000:cPbL][Feb 2000:cPbL][Jul 2000:cPbL][Oct 2000:cPbL][May 2001:cPbL][June 2001: cPbL][March 2005:cPbL][Note: contact me for updates]
Christopher Paul Barrington-Leigh / Stanford / cpbl@