Go to the first, previous, next, last section, table of contents.

Special sorts of typesetting

Drawing with TeX

There are many packages to do pictures in (La)TeX itself (rather than importing graphics created externally), ranging from simple use of LaTeX picture environment, through enhancements like epic, to sophisticated (but slow) drawing with PicTeX. Depending on your type of drawing, and setup, four systems should be at the top of your list to look at:

  1. graphics/pstricks; this gives you access to all the power of PostScript from TeX itself, by sophisticated use of \specials. You need a decent DVI to PostScript driver (like dvips), but the results are worth it. The well-documented package gives you not only low-level drawing commands (and full colour) like lines, circles, shapes at arbitrary coordinates, but also high-level macros for framing text, drawing trees and matrices, 3D effects, and more.
  2. MetaPost; you liked METAFONT, but never got to grips with font files? Try MetaPost - all the power of METAFONT, but it generates PostScript figures. Knuth uses it for all his work...
  3. Mfpic; you liked METAFONT, but can't understand the language? The package (graphics/mfpic) makes up METAFONT code for you within using familiar-looking TeX macros. Not quite the full power of METAFONT, but a friendlier interface.
  4. You liked PicTeX but don't have enough memory or time? Look at Eitan Gurari's macros/generic/dratex, which is as powerful as most other TeX drawing packages, but is an entirely new implementation, which is not as hard on memory, is much more readable (and is fully documented).

Double-spaced documents in LaTeX

Are you producing a thesis, and trying to obey regulations that were drafted in the typewriter era? Or are you producing copy for a journal that insists on double spacing for the submitted articles?

LaTeX is a typesetting system, so the appropriate design conventions are for ``real books''. If your requirement is from thesis regulations, find whoever is responsible for the regulations, and try to get the wording changed to cater for typeset theses (e.g., to say ``if using a typesetting system, aim to make your thesis look like a well-designed book''). (If your requirement is from a journal, you're probably even less likely to be able to get the rules changed, of course.)

If you fail to convince your officials, or want some inter-line space for copy-editing:

Formatting a thesis in LaTeX

Thesis styles are usually very specific to your University, so it's usually not profitable to ask around for a package outside your own University. Since many Universities (in their eccentric way) still require double-spacing, you may care to refer to the question on double-spacing. If you want to write your own, a good place to start is the University of California style (available as macros/latex209/contrib/ucthesis), but it's not worth going to a lot of trouble. (If officials won't allow standard typographic conventions, you won't be able to produce an aesthetically pleasing document anyway!)

Flowing text around figures in LaTeX

There are several LaTeX packages that purport to do this, but they all have their limitations because the TeX machine isn't really designed to solve this sort of problem. Piet van Oostrum has conducted a survey of the available packages; he recommends:

picins
picins.sty is part of a large package (macros/latex209/contrib/picins) that allows inclusion of pictures (e.g., with shadow boxes, various MS-DOS formats, etc.). The command is:

\parpic(width,height)(x-off,y-off)[Options][Position]{Picture}
Paragraph text

All parameters except the Picture are optional. The picture can be positioned left or right, boxed with a rectangle, oval, shadowbox, dashed box, and a caption can be given which will be included in the list of figures.

Unfortunately (for those of us whose understanding of German is not good), the documentation is in German. Piet van Oostrum has written an English summary macros/latex209/contrib/picins/picins.txt

floatflt
macros/latex/contrib/other/floatflt is an improved version (for LaTeX2e) of floatfig.sty, and its syntax is:
\begin{floatingfigure}[options]{width of figure}
   figure contents
\end{floatingfigure}

There is a (more or less similar) floatingtable environment.

The tables or figures can be set left or right, or alternating on even/odd pages in a double-sided document.

The package works with the multicol package, but doesn't work well in the neighbourhood of list environments (unless you change your LaTeX document).

wrapfig
macros/latex/contrib/other/misc/wrapfig.sty has syntax:
\begin{wrapfigure}[height of figure in lines]{l|r}[overhang]{width}
  figure, caption, etc.
\end{wrapfigure}

The syntax of the wraptable environment is similar.

Height can be omitted, in which case it will be calculated by the package; the package will use the greater of the specified and the actual width. The {l,r,etc.} parameter can also be specified as i(nside) or o(utside) for two-sided documents, and uppercase can be used to indicate that the picture should float. The overhang allows the figure to be moved into the margin. The figure or table will entered into the list of figures or tables if you use the \caption command.

The environments do not work within list environments that end before the figure or table has finished, but can be used in a parbox or minipage, and in twocolumn format.

Alternative head- and footlines in LaTeX

The standard LaTeX document classes define a small set of `page styles' which (in effect) specify head- and footlines for your document. The set defined is very restricted, but LaTeX is capable of much more; people occasionally set about employing LaTeX facilities to do the job, but that's quite unnecessary - Piet van Oostrum has already done the work.

The package is found in directory macros/latex/contrib/other/fancyheadings and provides simple mechanisms for defining pretty much every head- or footline variation you could want; the directory also contains some (rather good) documentation and one or two smaller packages. Fancyheadings also deals with the tedious behaviour of the standard styles with intial pages, by enabling you to define different page styles for initial and for body pages.

Including a file in verbatim in LaTeX

A good way is to use Rainer Schöpf's verbatim.sty, which provides the command \verbatiminput that takes a file name as argument. This package is available as part of macros/latex/packages/tools

Another way is to use the alltt environment, which requires alltt.sty (which is now part of LaTeX).

The moreverb package (macros/latex/contrib/supported/moreverb) extends the facilities of verbatim package), providing a listing environment and a \listinginput command, which line-number the text of the file.

Generating an index in (La)TeX

Making an index is not trivial; what to index, and how to index it, is difficult to decide, and uniform implementation is difficult to achieve. You will need to mark all items to be indexed in your text (typically with \index commands).

It is not practical to sort a large index within TeX, so a post-processing program is used to sort the output of one TeX run, to be included into the document at the next run.

The following programs are available:

makeindex
for LaTeX under Unix (but runs under other OSs without changes). Available in indexing/makeindex; a version for the Macintosh is available as systems/mac/macmakeindex.sit, and ones for MS-DOS are part of the emTeX and gTeX distributions (the emTeX version also runs under OS/2).

The Makeindex documentation is a good source of information on how to create your own index. Makeindex can be used with some TeX macro packages other than LaTeX, such as Eplain.

idxtex
for LaTeX under VMS. Available (together with a glossary-maker called glotex) in indexing/glo+idxtex
texindex
A witty little shell/sed-script-based utility for LaTeX under Unix. Available from support/texindex

There are other programs called texindex, notably one that comes with the Texinfo distribution.

Using BibTeX with plain TeX

The file macros/eplain/btxmac.tex contains macros and documentation for using BibTeX with plain TeX, either directly or with Eplain. See the use of BibTeX for more information about BibTeX itself.

Typesetting music in TeX

A powerful package which allows the typesetting of polyphonic and other multiple-stave music is MusicTeX, written by Daniel Taupin (taupin@rsovax.lps.u-psud.fr). It is available in macros/musictex

In the recent past, Daniel (as well as with various other people, notably Ross Mitchell and Andreas Egler) have been working on a development of MusicTeX, known as MusiXTeX. MusiXTeX is a three-pass system (with a processor program that computes values for the element spacing in the music), and achieves finer control than is possible in the unmodified TeX-based mechanism that MusicTeX uses. Daniel Taupin and Andreas Egler are pursuing distinct versions of MusiXTeX; they are available, respectively, from macros/musixtex/taupin and macros/musixtex/egler

Digital music fans can typeset notation for their efforts by using midi2tex, which translates MIDI data files into MusicTeX source code. It is available from support/midi2tex

A rather simpler notation than MusicTeX is supported by abc2mtex; this is a package designed to notate tunes stored in an ASCII format (abc notation). It was designed primarily for folk and traditional tunes of Western European origin (such as Irish, English and Scottish) which can be written on one stave in standard classical notation. However, it should be extendable to many other types of music. It is available from support/abc2mtex

There is a mailing list for discussion of typesetting music in TeX. To subscribe, send mail to mutex-request@stolaf.edu containing the word `subscribe' in the body.

Drawing Feynman diagrams in LaTeX

Michael Levine's macro package for drawing Feynman diagrams in LaTeX is available in macros/latex209/contrib/feynman

Another possibility is Thorsten Ohl's macros/latex/contrib/supported/feynmf, that works in combination with METAFONT (or MetaPost). The feynmf or feynmp package reads a description of the diagram written in TeX, and writes out code. METAFONT (or MetaPost) can then produce a font (or PostScript file) for use in a subsequent LaTeX run. For new users, who have access to MetaPost, the PostScript version is probably the better route, for document portability and other reasons.


Go to the first, previous, next, last section, table of contents.