Typesetting

Document Preparation, Typesetting

Using Latex for typesetting anything of the size of theses is a wise decision. Among its virtues is the very high quality of its typesetting of equations. There are exjobb (MSc Thesis) templates and general letter and poster templates available among the KTH/EE templates. There are licentiate/doctoral thesis templates available among the KTH/NADA templates. In either case, several files are needed, at least the something.tex to which content is added, and the something.sty that defines the formatting for this document type. Another way to obtain a more suitably configured template is just to ask for a copy of the Latex files of a helpful colleague's already written thesis! This has the extra advantage of giving many examples of how figures and equations were managed. The necessary programs for compiling Latex markup into a PDF or PS file should be available on your desktop computer as well as on the simulation servers; ask the system administrator if you can't find them.

A rather good, though (because?) slightly polemical, page about the `right tool for the job' in document preparation, is `Word Processors: Stupid and Inefficient'. It has a lot of truth to it, and is well written, so I simply refer to it for some of the justification for the dominance of the first section below, over the last!

TeX and LaTeX

TeX is a typesetting system written by Donald Knuth in an effort to improve the quality of mathematical typesetting back in the 1980s, so that he could enjoy reading papers again. This page gives an amusing idea of the stringency of his standards! Using Latex for any thesis is particularly recommended: the result will look far better than it would from `the alternative', even if no maths is involved.

Latex is a set of macros for making it easier to apply TeX to common tasks in typesetting books and papers. It is vastly widely used in mathematical disciplines. It is also, once one has come over the initial small hurdle, a very much more pleasant way to write almost anything than is a WYSIWYG `word-processor'; less mouse-clicking, easy auto-generation of the code (for example, to make a report with a standard set of figures from some result data), and beautiful results.

All that is needed to write with Latex is a text editor in which to write the markup text (actual text, plus instructions about the nature of each part, such as heading, maths, etc.). Compilation by the command `latex' or `pdflatex' produces a dvi or pdf file. There are many available templates, and many packages that allow enhancements and adjustments. It is best get a suitable template and `just write', rather than trying to adjust all the little details; the basics of sections and equations can be mastered easily, but the fine details of controlling the precise appearance are far more complex (and usually not neccesary). A close-to-home page gives an introduction, and various introductions may be found by searching.

A good way to start is by example: so -- take, for example, a famous 1905 paper specrel.tex (re-typeset, in English, obtained from Fourmilab.ch). Or start writing within an example file, genrep.tex for a general purpose report with lots of options. To use these, save the file, e.g. name.tex, view it a bit with a text editor (it's just a plain-text markup language), then compile with `latex name.tex' and (if successful) view the dvi output by `xdvi name.dvi' or `kdvi name.dvi' (again, see here). Conversion to other formats can be done as `dvips -o name.ps name.dvi' to postscript, and thence to pdf by `ps2pdf -sPAPERSIZE=a4 name.ps name.pdf'; pdflatex can generate pdf directly if any included figures are pdf or jpg etc. but not eps.

Specialised LaTeX editors

Kile is an `integrated LaTeX environment', meaning that it provides an editor along with some handy short-cuts that allow insertion of Latex code by clicking on desired symbols or menu-items, then it does the job of compilation and display. A middle-click in the dvi file takes you to the position in the Latex source-code that generated the clicked part of the output. Other such programs exist, e.g. AmyEdit.

Of course, Emacs was sure to have a Latex mode: AUCTeX is its name, and the appealing screenshots on that site may make it seem desirable.

TeXmacs is a WYSIWYG TeX-based word-processor, which manages to capture much of the best of both worlds: it is good to have the familiar, keyboard-based production of equations and text, along with the ability to see for example the final form of an equation while writing about it. When one gets used to the idea of pressing Enter after each Latex command (e.g., do some normal text, then the dollar symbol and Enter, to get maths mode, then the command \int and Enter to get an integral sign, then the command ^ and Enter to get a superscript, then the right-arrow to get out of the superscript, etc.), then it's very handy. The ability to run an inline Session of e.g. Shell, Python, Matlab, Axiom, etc. and to present a text-based reply as a typeset equation, is very nice. For example, in an Axiom session, "Insert", "Session", "Axiom", then type `integrate( tan(x), x )' (Enter), and watch as a wonderfully readable, typeset reply turns up! TeXmacs has a very neat and clear file-save format.

Lyx is another Latex-based WYSIWYG type of program.

Other Document-Preparation systems

The traditional Unix typesetting programs were the `nroff' ones, based on a simple markup language. Preprocessor filters such as `eqn', `pic', `tbl' `chem' `grap' `refer' added support for turning extra markup into the basic roff markup for equations, pictures, tables, references, etc. We have all these parts in the modern GNU version, Groff. It is used in formatting traditional manual pages, but can also be used with different formatting styles suitable for papers. I've never got at all familiar with it, as Latex is much superior for typical technical work, but the quality of equations and typesetting with groff will surely equal or better that of `word-processors'.

The `word-processor' is a common sort of program nowadays, and although generally much less suited to technical input and good quality output than the above programs, it has its advantages, for example for a quick and easy table for booking labs. The OpenOffice.org suite is available on our systems, providing word-processor, spreadsheet and presentation programs that support several file formats including the (native) ISO-standard Open-Document format (see also on wikipedia), besides various ages of ms-office formats, rtf, etc.


Page started: 2007-11-xx
Last change: 2008-04-08