CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit for current CERN information.

next up previous
Next: National language support Up: Text Processing Previous: Drawing Feynman Diagrams with

A new Directory Structure for TeX Files



TeX is a powerful, flexible typesetting system used by tens of thousands of people around the world. It is extremely portable and runs on virtually all operating systems. One unfortunate side effect of TeX's flexibility, however, is that there has been no single ``right'' way to install it. This has resulted in many sites having different installed arrangements.

A working group of specialists of the TeX world was created in 1994, and it produced recently a proposal (for a complete description see TUGboat 16 f(16), pages 401-413, or in electronic form, whose main points and effects for the CERN setup are the subject of this article.

As a first principle, the TeX Directory Structure (TDS) setup has been designed to work on all modern systems, in particular it copes with MacOS, ms-dos, os/2, Unix, vms, and Windows (3.x, 95, and nt). The same file base can thus be used on multiple platforms simultaneously.

Top-level directories

The directories under the TEXMF root (at CERN we have chosen a gnu-compatible /usr/local/share/texmf root directory) identify the major components of a TeX system.

The top-level directories specified by the TDS are:

TeX files;
font-related files;
(non-font) METAFONT files;
MetaPost files;
BibTeX files;
user documentation;
sources, e.g., Web2c sources go in texmf/source/web2c or LaTeX dtx sources go in texmf/source/latex;
implementations (such as emtex, web2c); this directory contains files that cannot be shared between implementations, such as pool files (tex.pool) and memory dump files (plain.fmt), as well as implementation-wide configuration files;
program-specific input files for TeX-related programs (e.g. for mft, dvips).

A few words on fonts

Font files are stored in separate directories, segregated by file type, font supplier, and typeface.


is the type of font file. The TDS reserves the following type names, such as pk (packed bitmap files), source (font sources, i.e. METAFONT files, property lists, etc.), tfm (TeX font metric files), type1 (Type 1 fonts in any format), vf (virtual fonts).
is a name identifying font source (examples: adobe, ams, public).
name of a typeface family (examples: cm, euler, latex, times).

Some concrete examples:


Font bitmap files require two characteristics in addition to the above to be uniquely identifiable: (1) the type of device (i.e., mode) for which the font was created; (2) the resolution of the bitmap.

As TDS has to cope with file systems which do not support long filenames, the font bitmaps are segregated into directories by resolution (e.g., dpi300/, so that we have two more subdirectory levels under pk and gf:


is a name which identifies the device type (examples: cx, gsftopk, ljfour).
specifies the resolution of the font (examples: dpi300, dpi329). `dpi' stands for dots per inch, i.e., pixels per inch.

  bibtex/              BibTeX input files
  . bib/               BibTeX databases
  . . base/            base distribution (e.g., xampl.bib)
  . . misc/            single-file databases
  . /         name of a package
  . bst/               BibTeX style files
  . . base/            base distribution (e.g., plain.bst, acm.bst)
  . . misc/            single-file styles
  . /         name of a package
  doc/                 see Table 1.2
  fonts/               font-related files
  . /            file type (e.g., pk)
  . . /          type of output device (for pk and gf only)
  . . . /    name of a font supplier (e.g., public)
  . . . . /  name of a typeface (e.g., cm)
  . . . . . dpi/  font resolution (for pk and gf only)
  /    TeX implementations, by name (e.g., emtex)
  metafont/            METAFONT (non-font) input files
  . base/              base distribution (e.g.,
  . misc/              single-file packages (e.g.,
  . /         name of a package (e.g., mfpic)
  metapost/            MetaPost input and support files
  . base/              base distribution (e.g.,
  . misc/              single-file packages
  . /         name of a package
  . support/           support files for MetaPost-related utilities
  mft/                 MFT inputs (e.g., plain.mft)
  /           TeX-related programs, by name (e.g., dvips)
  source/              program source code by name (e.g., latex, web2c)
  tex/                 TeX input files
  . /          name of a format (e.g., plain)
  . . base/            base distribution for format (e.g., plain.tex)
  . . misc/            single-file packages (e.g., webmac.tex)
  . . local/           local additions to or local configuration files for format
  . . /       name of a package (e.g., graphics, mfnfss)
  . generic/           format-independent packages
  . . hyphen/          hyphenation patterns (e.g., hyphen.tex)
  . . images/          image input files (e.g., Encapsulated PostScript)
  . . misc/            single-file format-independent packages (e.g., null.tex)
  . . /       name of a package (e.g., babel)

A skeleton of a TDS texmf directory tree


Most packages come with some form of documentation: user manuals, example files, programming guides, etc. In addition, many independent files not part of any macro or other package describe various aspects of the TeX system.

The TDS specifies that these additional documentation files shall be stored in a structure that parallels to some extent the fonts and tex directories, as follows:


category identifies the general topic of documentation that resides below it; for example, a TeX format name (latex), program name (bibtex, tex), or other system component (web, fonts).

  . amsfonts/        amsfonts.faq, amfndoc
  . amslatex/        amslatex.faq, amsldoc
  . amstex/          amsgauide, joyerr
  bibtex/            BibTeX
  . base/            btxdoc.tex
  . fontname/        Filenames for TeX fonts
  . oldgerm/         corkpapr
  /          name of a TeX format (e.g., generic, latex)
  . base/            for the base distribution
  . misc/            for contributed single-file package documentation
  . /       for package
  general/           across programs, generalities
  . errata/          errata, errata[1-8]
  . texcomp/         Components of TeX
  generic/           for non-format-specific TeX packages
  . babel/      
  . german/          germdoc
  help/              meta-information
  . ctan/            info about ctan mirror sites
  . faq/             faqs of comp.text.tex, etc.
  html/              html files
  info/              gnu Info files, made from Texinfo sources
  latex/             example of format
  . base/            ltnews*, *guide, etc.
  . graphics/        grfguide
  /         TeX-related programs, by name (examples follow)
  metafont/          mfbook.tex, metafont-for-beginners, etc.
  metapost/          mpman, manfig, etc.
  tex/               texbook.tex, A Gentle Introduction to TeX, etc.
  web/               webman, cwebman

A skeleton of a TDS directory tree under texmf/doc

Executable programs

The location of executable programs is generally site dependent and also differs across the various platforms. For instance, on Unix, executables are often stored in the directory /usr/local/bin.

Subdirectory searching

Recursive subdirectory searching is the ability to specify a search not only of a specified directory dir, but recursively of all directories below dir. Different implementations or applications specify subdirectory searching differently, as shown below.

TEXFONTS_SUBDIR environment variable;

On the Unix systems at CERN, we use the Web2c implementation for the TeX programs. All implementation-dependent TeX system files (.pool, .fmt, .base, .mem) are stored by default directly in texmf/web2c. The configuration file texmf.cnf and various subsidiary MakeTeX... scripts used as subroutines are also stored there.

Non-TeX specific files are stored following the GNU coding standards. Given a root directory prefix (/usr/local by default), we have default locations as follows:

/          installation root
. bin/             executables
. man/             man pages
. info/            info files
. lib/             libraries (libkpathsea.*)
. share/
. . texmf/         TDS root
. . . web2c/       implementation-dependent files
                     (.pool, .fmt, texmf.cnf, etc.)

Changing the CERN TeX setup

The tds group is in the process of preparing a ``plug-and-play'' CD-ROM, containing executables for most Unix systems, plus the cross-platform tds file structure outlined in the previous sections. At CERN, I plan to move to the tds structure on the asis Unix file base during the second week of May (probably during the weekend of May 11/12). At that time the old setup (available on some platforms with the oldlatex command) will be deleted (this is overdue, since I originally announced this deletion for the summer of 1995!). If a user wants to continue using this old setup, it will have to be copied to the user's private disk space before that date. Later the same system will be installed on VMS and Nice, so that we can benefit from a uniform file base throughout all text processing platforms (at present it is not known whether TeXtures, the TeX version we use on Macintosh, will also adopt the tds file structure, but there is good hope that they will). Thanks to the fact that CERN will use the ``(TeX) world standard'' system, all HEP institutes will be able to copy the CERN structure and hence be compatible with other setups which adhere to the same standard. They will also be able to buy the CD-ROM mentioned above (it should be available by the beginning of June), which will be ISO 9660-compatible, so that in principle it will be possible to mount it on VMS, PC (DOS, Windows) and Mac also.

next up previous
Next: National language support Up: Text Processing Previous: Drawing Feynman Diagrams with

Michel Goossens
CN Division
Tel. 3363
Wed Mar 13 09:06:53 MET 1996