# ConTeXt and pdfTeX Beginners Help Page

Best Viewed With Any Browser

Last updated: April 23, 2002

- Introduction
- Essential Links
- File Locations
- Installation
  - ConTeXt
  - pdfTeX
- Selecting Fonts
  - Simple (and not very useful) method
  - Using Typescripts
- Installing New Fonts
  - Type1
    - Using texfont
  - TrueType
- Typography
  - Tight word spacing
  - Indenting
  - Using smaller symbols
  - Dashes
  - Letterspacing capitals and small caps
  - Margin kerning: Hanging punctuation and protruding characters

## Introduction

I am a beginner at TeX myself, and wanted to use this page to record those little hints and examples which helped me over the rough spots, in the hope that they may help others. I'll refine and extend the examples as I gain more experience.

The techniques I describe here are used to produce all of the Sattre Press titles.

I presume the reader has all the documents available from the ConTeXt and pdfTeX web pages. Other sources of information: both packages have email support lists which are archived on the web. Searching the usenet group `comp.text.tex` can be useful also.

I use SuSE Linux. However, it seems that TeX knowledge is rather portable across systems, and it should be possible to adapt the examples to other platforms.

## Essential Links

- ConTeXt
  - www.pragma-ade.nl or ds035.xs4all.nl (fallback page)
  - www.pragma-ade.com (primary page, but out of action for a while)
  - www.ntg.nl/context (temporary)
  - Mailing list archives
- pdfTeX
  - TUG pdftex support page

## File Locations

Everything in the TeX world has its place. There is a vast amount of material in the TeX directory tree, which on my system starts at `/usr/share/texmf`.

Further, you can customize local and auxiliary directory structures. Look at `texmf.cnf`.

Experiment with the `kpsewhich` utility, particularly with the `--show-path` option, which shows all the different places in which TeX will look for different files.

Using this, I see that the current directory is always first in the path, meaning I can make all sorts of "system" changes which effect only the current project. As far as I can tell, all files of interest are treated this way: `.cfg, .cnf, .tex, .map, .tfm, .pfb,` etc.

Once a new file becomes stable it can be promoted to later ("higher") directories in the search path. `kpsewhich` shows that I have a personal TeX directory tree in my home directory: `/home/wmcclain/texmf`. Then there are site-specific directories, etc.

Remember: if you add or delete any files in the TeX tree (see the list of directories `$TEXMFDBS` in `texmf.cnf`, you must rebuild the filename database with `mktexlsr`. On my system, `texhash` is a synonym for this command.

On Linux, I run `updatedb` daily, and use `locate` to find all those pesky configuration files.

## Installation

SuSE Linux comes with both ConTeXt and pdfTeX, but these packages are updated rather frequently and it is necessary to upgrade without waiting for SuSE.

These notes are not a replacement for the real installation docs! I just show what I actually do when upgrading.

I do the upgrade in the main TeX tree: `/usr/share/texmf`. If I were ambitious I would test in some auxiliary directory first, but I haven't had much trouble yet. I have backups and am able to reinstall pretty quickly.

> ### ConTeXt

> `

>     su root

>     mv cont-tmf.zip /usr/share/texmf
>     cd /usr/share/texmf
>     rm /usr/share/texmf/tex/context/base/*
>     unzip -a -L -o cont-tmf.zip  # overwrites existing files!

>     # SuSE wants the executables here...
>     cp context/perltk/texexec.pl /usr/share/texmf/teTeX/bin/i386-linux-glibc/texexec
>     cp context/perltk/texshow.pl /usr/share/texmf/teTeX/bin/i386-linux-glibc/texshow
>     cp context/perltk/texutil.pl /usr/share/texmf/teTeX/bin/i386-linux-glibc/texutil

>     # Edit texexec.ini afterwards?
>     cp /usr/share/texmf/context/config/texexec.rme /usr/share/texmf/context/config/texexec.ini

>     # Edit cont-sys.tex afterwards?
>     cp /usr/share/texmf/tex/context/user/cont-sys.rme /usr/share/texmf/tex/context/user/cont-sys.tex

>     texhash
>     texexec --make en  # en = english
>     texhash

>     exit # from "su root"

> `

> ### pdfTeX

> `

>     cp pdftex-20010417.tgz /tmp   # or whatever the latest snapshot is called
>     cd /tmp
>     tar zxvf pdftex-20010417.tgz  # or whatever the latest snapshot is called
>     cd src
>     configure
>     cd texk/web2c
>     make pdftexbin # may need "tangle" from previous build

>     su root

>     cp *.pool /usr/share/texmf/web2c

>     # SuSE wants the executables here...
>     cp pdftex /usr/share/texmf/teTeX/bin/i386-linux-glibc
>     cp pdfetex /usr/share/texmf/teTeX/bin/i386-linux-glibc
>     cp ttf2afm /usr/share/texmf/teTeX/bin/i386-linux-glibc

>     # first time only, add this to /etc/profile.local:
>     #
>     #    export TEXMFCNF=`kpsewhich -show-path=.cnf`

>     texhash
>     texexec --make en
>     texhash

>     exit # from "su root"

> `

## Selecting Fonts

Fonts are a complicated business, but become easier to deal with once you have run a few experiments. The primary document is Fonts in ConTeXt (`mfonts.pdf`).

Note that we tend to be spoiled by the default Computer Modern font which has a large number of good features which just work automatically. Emulating that capability with a new font requires a good deal of setup.

> ### Simple (and not very useful) method

> You can simply specify a font file and use it, either in plain TeX or by using ConTeXt macros. This is not very useful because it does not give you the convenient switching to italic, bold, small caps, math mode, etc, which a well-defined typeface will do. However, it is instructive to try it, just to prove that the system is setup correctly and that the maps and font files can be found.

> You can (for a start) use any font listed in `pdftex.map`, presuming both the `.tfm` and `.pfb` font files exist. (This is not always the case on my system).

> For example, here is the first data line in my `pdftex.map` file:

> > `bchb8r CharterBT-Bold "TeXBase1Encoding ReEncodeFont" <8r.enc <bchb8a.pfb`

> The contents of `pdftex.map` are documented in The pdfTeX User Manual (`pdftexman.pdf`). For now, just note that this line refers to "Bitstream Charter Bold." The first field, `bchb8r`, is the name of a `.tfm` (TeX Font Metric) file, and `bchb8a.pfb` is a Type1 font file. In TeX programs, fonts are identified by their `.tfm` names.

> Since both `bchb8r.tfm` and `bchb8a.pfb` exist on my system, I can use the font as follows.

> Using just plain TeX:

> > `

> >     \font\myfirstfont=bchb8r
> >     \myfirstfont Of wind I sang, a wind there came, and in the branches blew.

> > `

> Using ConTeXt macros:

> > `

> >     \definefontsynonym[CharterBT-Bold][bchb8r][encoding=8r]
> >     \definefont[MySecondFont][CharterBT-Bold]
> >     \starttext
> >     \MySecondFont I sang of leaves, of leaves of gold, and leaves of gold there grew.
> >     \stoptext

> > `

> ### Using Typescripts

> ConTeXt now uses typescripts to define and select fonts. This is the way to go for maximum flexibility.

> "Typescripts are in fact just organized definitions" says `mfonts.pdf`. They are a way of building a database of names which provides layers of abstraction. The TeX document can be written so that it will continue to be "correct" even as major changes in fonts, families and styles are made at the deeper levels.

> #### typescript files

> Typescripts are definitions contained between `\starttypescript` and `\stoptypescript`. The typescripts are found in and loaded from several file sources:
> - Several `type-*.tex` files are automatically searched. See the list in `mfonts.pdf`.
> - A file `type-loc.tex` in the search path will be searched automatically.
> - Any file in the search path, for example, `myscripts.tex`, can be loaded with `\usetypescriptfile[myscripts]`.

> #### A simple example

> For example, using Bitstream Charter again, I have these fonts on my system:

> > `bchr8r` | roman
> > `bchb8r` | bold
> > `bchri8r` | italic
> > `bchbi8r` | bold italic

> I can create this typescript file, `type-charter.tex`:

> > `

> >     \usetypescriptfile[type-buy]

> >     \starttypescript [serif] [charter] [8r]
> >       \definefontsynonym [Charter-Roman]       [bchr8r]  [encoding=8r]
> >       \definefontsynonym [Charter-Bold]        [bchb8r]  [encoding=8r]
> >       \definefontsynonym [Charter-Italic]      [bchri8r] [encoding=8r]
> >       \definefontsynonym [Charter-Bold-Italic] [bchbi8r] [encoding=8r]
> >     \stoptypescript

> >     \starttypescript [serif] [charter] [name]
> >       \usetypescript[serif][fallback]
> >       \definefontsynonym [Serif]           [Charter-Roman]
> >       \definefontsynonym [SerifBold]       [Charter-Bold]
> >       \definefontsynonym [SerifItalic]     [Charter-Italic]
> >       \definefontsynonym [SerifBoldItalic] [Charter-Bold-Italic]
> >     \stoptypescript

> >     \starttypescript [Charter]
> >       \definetypeface [MyCharter] [rm] [serif] [charter] [default] [encoding=8r]
> >     \stoptypescript

> > `

> And use it like this:

> > `

> >     \usetypescriptfile[type-charter]
> >     \usetypescript[Charter]
> >     \setupbodyfont[MyCharter]

> >     \starttext
> >     This is roman, {\bf bold}, {\it italic}, {\bi bold-italic},
> >     {\tfa bigger} and {\tfx smaller}.
> >     \stoptext

> > `

> #### Multiple fonts

> I also have Adobe Utopia, so I can make a `type-utopia.tex` typescript file very similar to the Charter example above:

> > `

> >     \usetypescriptfile[type-buy]

> >     \starttypescript [serif] [utopia] [8r]
> >       \usetypescript[serif][fallback]
> >       \definefontsynonym [Utopia-Roman]       [putr8r]  [encoding=8r]
> >       \definefontsynonym [Utopia-Bold]        [putb8r]  [encoding=8r]
> >       \definefontsynonym [Utopia-Italic]      [putri8r] [encoding=8r]
> >       \definefontsynonym [Utopia-Bold-Italic] [putbi8r] [encoding=8r]
> >     \stoptypescript

> >     \starttypescript [serif] [utopia] [name]
> >       \definefontsynonym [Serif]           [Utopia-Roman]
> >       \definefontsynonym [SerifBold]       [Utopia-Bold]
> >       \definefontsynonym [SerifItalic]     [Utopia-Italic]
> >       \definefontsynonym [SerifBoldItalic] [Utopia-Bold-Italic]
> >     \stoptypescript

> >     \starttypescript [Utopia]
> >       \definetypeface [MyUtopia] [rm] [serif] [utopia] [default] [encoding=8r]
> >     \stoptypescript

> > `

> And then use both fonts in the same job:

> > `

> >     \usetypescriptfile[type-charter]
> >     \usetypescript[Charter]
> >     \usetypescriptfile[type-utopia]
> >     \usetypescript[Utopia]
> >     \setupbodyfont[MyCharter]

> >     \starttext
> >     This is Charter roman, {\bf bold}, {\it italic}, {\bi bold-italic},
> >     {\tfa bigger} and {\tfx smaller}.

> >     \switchtobodyfont[MyUtopia]
> >     This is Utopia roman, {\bf bold}, {\it italic}, {\bi bold-italic},
> >     {\tfa bigger} and {\tfx smaller}.
> >     \stoptext

> > `

> Note that the default Computer Modern font is always available, even when the job defines other fonts: declare it with `\usetypescript[modern][default]` and select it with `\switchtobodyfont[modern]`.

> #### Questions

> > What does the `\usetypescriptfile[type-buy]` do? It loads a typescript which contains the definition of the `[serif][fallback]` typescript which I use later.

> > What does the `\usetypescript[serif][fallback]` do? It simplifies the definition of my new typescript. My example fonts are very simple and do not have slanted or smallcaps variants. ConTeXt requires those variants to be defined. I could add dummy declarations and define SerifSlanted to be the same as SerifItalic, SerifBoldSlanted to be SerifBoldItalic, and SerifCaps to be simply Serif. However, if you look at the definition of the `[serif][fallback]` typescript in `type-buy.tex`, you will see that those declarations have already been made. My typescript can "inherit" from the predefined fallback typescript.

> > What about the `encoding=8r` references? I specified these because that was what was listed for these fonts in `pdftex.map`. I'll try to add more on encodings to this document someday.

> > What are the parameters to `\starttypescript`? Typescripts can have up to three "specifiers". It is like having a database where you can use up to three keys to find a record. You can make up your own values. For example, if I have:

> > > `

> > >     \starttypescript[A][B][C]
> > >     % ...various statements
> > >     \stoptypescript

> > > `

> > I can find and execute the typescript with:

> > > `

> > >     \usetypescript[A][B][C]

> > > `

> > The keyword `all` matches any value:

> > > `

> > >     \usetypescript[A][B][all]

> > > `

> > These examples will not match typescript `[A][B][C]`:

> > > `

> > >     \usetypescript[A]
> > >     \usetypescript[A][B]
> > >     \usetypescript[A][B][D]

> > > `

> > You can have lists of key values to match. If I have:

> > > `

> > >     \starttypescript[A][B][C]
> > >     % ...various statements
> > >     \stoptypescript

> > >     \starttypescript[A][B][Z]
> > >     % ...various statements
> > >     \stoptypescript

> > > `

> > Then I can execute both typescripts with:

> > > `

> > >     \usetypescript[A][B][C,Z]

> > > `

> > Note that the search for typescript matches has a cumulative effect. Our database allows duplicate key values and the search will find and execute all the matches.

> > What are the parameters to `\definetypeface`? This is where it all comes together. Suppose we have:

> > > `

> > >     \definetypeface[A][B][C][D][E][F]

> > > `

> > This means:
> > - Define typeface `A` (any name you like) in its variant `B`, where the common variants are:
> >   - `rm`: roman (normal)
> >   - `ss`: sans serif
> >   - `tt`: monospaced
> >   - `mm`: math mode
> >   - `cg`: calligraphy
> > - Use typescript `[C][D][name]` to define the styles for this variant. `C` can be any name you like, but by convention is commonly one or more of:
> >   - `serif`
> >   - `sans`
> >   - `mono`
> >   - `math`
> >   - `handwriting`
> >   `D` can be any name you like. Usually it is some variation on the font name.
> > - Use typescript `[C][E][size]` to define the size information for this typeface.
> > - Use `F` for other options, typically `encoding` and `rscale`.
> > Example. Now we can interpret the setup of the font Charter as given above:

> > > `

> > >     \starttypescript [serif] [charter] [name]
> > >       \usetypescript[serif][fallback]
> > >       \definefontsynonym [Serif]           [Charter-Roman]
> > >       \definefontsynonym [SerifBold]       [Charter-Bold]
> > >       \definefontsynonym [SerifItalic]     [Charter-Italic]
> > >       \definefontsynonym [SerifBoldItalic] [Charter-Bold-Italic]
> > >     \stoptypescript

> > >     \starttypescript [Charter]
> > >       \definetypeface [MyCharter] [rm] [serif] [charter] [default] [encoding=8r]
> > >     \stoptypescript

> > > `

> > This means:
> > - Create a typescript `Charter` which packages all the following.
> > - Define a font "MyCharter" in its normal (roman) variant.
> > - Use typescript `[serif][charter][name]` to define its styles.
> > - Use typescript `[serif][fallback]` for any styles we haven't defined.
> > - Use typescript `[serif][default]` for the size information. (Found in `type-siz.tex`).
> > - Use encoding `8r`.
> > What are the predefined style names? The style names used in the `\definefontsynonym` are special in that ConTeXt uses them to implement the font switching macros such as `\bf, \it, \sc,` etc. The predefined names are: `
> > - [Serif,Sans,Mono]
> > - [Serif,Sans,Mono]Bold
> > - [Serif,Sans,Mono]Italic
> > - [Serif,Sans,Mono]BoldItalic
> > - [Serif,Sans,Mono]Slanted
> > - [Serif,Sans,Mono]BoldSlanted
> > - [Serif,Sans,Mono]Caps
> > `

> > We also have these styles: ``

> > - MathAlpha
> > - MathAlphaBold
> > - MathBeta
> > - MathExtension
> > - MathExtensionBold
> > - MathGamma
> > - MathItalic
> > - MathItalicBold
> > - MathRoman
> > - MathRomanBold
> > - MathSymbol
> > - MathSymbolBold
> > - OldStyle

## Installing New Fonts

> ### Type1

> #### Using `texfont`

> > The `texfont` utility is part of the ConTeXt package. It can be used instead of `fontinst` to install new fonts. The manual is Texfont Explained (`mtexfont.pdf`).

> > I purchased Adobe Sabon from Eyewire because the Adobe site was not happy with my browser that day. The typeface was in two packages: "Sabon" and "Sabon SC+OSF". I chose the Windows Type1 variants and downloaded these two files:

> > > `

> > >     17100088.exe
> > >     17100197.exe

> > > `

> > I had been told that these .exe files were actually zip archives. Not true. They were MS Windows executables. I had to take them to an MS machine to unpack them.

> > The Sabon files:

> > > `

> > >     Install instructions.txt
> > >     license.txt
> > >     readme.txt
> > >     sab_____.afm
> > >     sabi____.afm
> > >     sabi____.inf
> > >     sab_____.inf
> > >     sabi____.pfb
> > >     sabi____.pfm
> > >     sab_____.pfb
> > >     sab_____.pfm
> > >     sai_____.afm
> > >     sai_____.inf
> > >     sai_____.pfb
> > >     sai_____.pfm
> > >     sar_____.afm
> > >     sar_____.inf
> > >     sar_____.pfb
> > >     sar_____.pfm

> > > `

> > The Sabon SC+OSF files:

> > > `

> > >     Install instructions.txt
> > >     license.txt
> > >     readme.txt
> > >     sabio___.afm
> > >     sabio___.inf
> > >     sabio___.pfb
> > >     sabio___.pfm
> > >     sabof___.afm
> > >     sabof___.inf
> > >     sabof___.pfb
> > >     sabof___.pfm
> > >     saiof___.afm
> > >     saiof___.inf
> > >     saiof___.pfb
> > >     saiof___.pfm
> > >     sarsc___.afm
> > >     sarsc___.inf
> > >     sarsc___.pfb
> > >     sarsc___.pfm

> > > `

> > Only the `.afm` and `.pfb` files are needed for TeX.

> > I put the originals in a safe place and copied all the files into a temporary directory: `/tmp/fonts`. I decided to use the TeX root under my home directory for installing new fonts: `/home/wmcclain/texmf`.

> > For some reason the texfont utility is not executable when I install ConTeXt on my system, so I first do:

> > > `

> > >     su root
> > >     chmod +x /usr/share/texmf/context/perltk/texfont.pl

> > > `

> > Then, installing the font is a simple matter of:

> > > `/usr/share/texmf/context/perltk/texfont.pl --fontroot=/home/wmcclain/texmf --sourcepath=/tmp/fonts --vendor=adobe --collection=sabon --makepath --install`

> > I find these new paths and files created:

> > Under `/home/wmcclain/texmf/fonts/tfm/adobe/sabon`:

> > > `

> > >     texnansi-raw-sabio.tfm
> > >     texnansi-raw-sabi.tfm
> > >     texnansi-raw-sabof.tfm
> > >     texnansi-raw-sab.tfm
> > >     texnansi-raw-saiof.tfm
> > >     texnansi-raw-sai.tfm
> > >     texnansi-raw-sarsc.tfm
> > >     texnansi-raw-sar.tfm
> > >     texnansi-sabio.tfm
> > >     texnansi-sabi.tfm
> > >     texnansi-sabof.tfm
> > >     texnansi-sab.tfm
> > >     texnansi-saiof.tfm
> > >     texnansi-sai.tfm
> > >     texnansi-sarsc.tfm
> > >     texnansi-sar.tfm

> > > `

> > Under `/home/wmcclain/texmf/fonts/type1/adobe/sabon`:

> > > `

> > >     sabio___.pfb
> > >     sabi____.pfb
> > >     sabof___.pfb
> > >     sab_____.pfb
> > >     saiof___.pfb
> > >     sai_____.pfb
> > >     sar_____.pfb
> > >     sarsc___.pfb

> > > `

> > Under `/home/wmcclain/texmf/fonts/vf/adobe/sabon`:

> > > `

> > >     texnansi-sabio.vf
> > >     texnansi-sabi.vf
> > >     texnansi-sabof.vf
> > >     texnansi-sab.vf
> > >     texnansi-saiof.vf
> > >     texnansi-sai.vf
> > >     texnansi-sarsc.vf
> > >     texnansi-sar.vf

> > > `

> > And finally, this file:

> > > `/home/wmcclain/texmf/pdftex/config/texnansi-adobe-sabon.map`

> > which contains the lines:

> > > `

> > >     % This file is generated by the TeXFont Perl script.
> > >     %
> > >     % You need to add the following line to pdftex.cfg:
> > >     %
> > >     %   map +texnansi-adobe-sabon.map
> > >     %
> > >     % Alternatively in your TeX source you can say:
> > >     %
> > >     %   \pdfmapfile{+texnansi-adobe-sabon.map}
> > >     %
> > >     % In ConTeXt you can best use:
> > >     %
> > >     %   \loadmapfile[texnansi-adobe-sabon.map]

> > >     texnansi-raw-sab Sabon-Bold 4 < sab_____.pfb texnansi.enc
> > >     texnansi-raw-sabi Sabon-BoldItalic 4 < sabi____.pfb texnansi.enc
> > >     texnansi-raw-sabio Sabon-BoldItalicOsF 4 < sabio___.pfb texnansi.enc
> > >     texnansi-raw-sabof Sabon-BoldOsF 4 < sabof___.pfb texnansi.enc
> > >     texnansi-raw-sai Sabon-Italic 4 < sai_____.pfb texnansi.enc
> > >     texnansi-raw-saiof Sabon-ItalicOsF 4 < saiof___.pfb texnansi.enc
> > >     texnansi-raw-sar Sabon-Roman 4 < sar_____.pfb texnansi.enc
> > >     texnansi-raw-sarsc Sabon-RomanSC 4 < sarsc___.pfb texnansi.enc

> > > `

> > That's the complete installation. We still have to define the typeface to ConTeXt, using the techniques shown above in "Selecting Fonts - Using Typescripts".

> > I create a file `type-sabon.tex` in the TeX path, which contains:

> > > `

> > >     %
> > >     % Adobe Sabon
> > >     %
> > >     \usetypescriptfile[type-buy]
> > >     \loadmapfile[texnansi-adobe-sabon.map]

> > >     \starttypescript [serif] [sabon] [texnansi]
> > >       \definefontsynonym [Sabon-Roman]          [texnansi-sar]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold]           [texnansi-sab]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Italic]         [texnansi-sai]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-Italic]    [texnansi-sabi] [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Roman-SmallCaps][texnansi-sarsc]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Italic-OSF]     [texnansi-saiof]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-OSF]       [texnansi-sabof]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-Italic-OSF][texnansi-sabio]  [encoding=texnansi]
> > >     \stoptypescript

> > >     \starttypescript [serif] [sabon] [name]
> > >       \usetypescript[serif][fallback]
> > >       \definefontsynonym [Serif]           [Sabon-Roman]
> > >       \definefontsynonym [SerifBold]       [Sabon-Bold]
> > >       \definefontsynonym [SerifItalic]     [Sabon-Italic]
> > >       \definefontsynonym [SerifBoldItalic] [Sabon-Bold-Italic]
> > >       \definefontsynonym [SerifCaps]       [Sabon-Roman-SmallCaps]
> > >       % the regular old-style figures are in the small-caps file
> > >       \definefontsynonym [OldStyle]        [Sabon-Roman-SmallCaps]
> > >     \stoptypescript

> > >     \starttypescript [Sabon]
> > >       \definetypeface [Sabon] [rm] [serif] [sabon] [default] [encoding=texnansi]
> > >     \stoptypescript

> > > `

> > Important: the `\loadmapfile` macro will not work unless the `\autoloadmapfilestrue` line is uncommented in `cont-sys.tex`.

> > Important: note that we do not reference the `texnansi-raw-*` files in the font declaration. I made that mistake in the first version. That usage works for many characters, but not for ligatures and some other things. The right way to do it is to reference the virtual font files, as shown.

> > Using the font is easy:

> > > `

> > >     \usetypescriptfile[type-sabon]
> > >     \usetypescript[Sabon]
> > >     \setupbodyfont[Sabon]

> > >     \starttext
> > >     This is Sabon roman, {\it italic,} {\bf bold,} and {\bi bold-italic.}

> > >     {\em \bf This is also bold-italic.}

> > >     We have {\sc small caps} and old-style figures: {\os 0123456789}.
> > >     \stoptext

> > > `

> > The font files defined in the typescript give us a palette for assembling new typefaces. For example, I bought eight font files, but three are not being used, the ones that have bold and italic old-style figures:

> > > `

> > >     [Sabon-Italic-OSF]     [texnansi-saiof]
> > >     [Sabon-Bold-OSF]       [texnansi-sabof]
> > >     [Sabon-Bold-Italic-OSF][texnansi-sabio]

> > > `

> > Indeed, ConTeXt does not provide a way of combining both old-style and bold or italic; this does not do what you think it might:

> > > `{\em \os 0123456789}`

> > The figures will be old-style regular, not italic. The way to use these fonts is to define a new typeface that always uses old-style figures in the bold and italic forms. We add some lines to `type-sabon.tex` which now looks like:

> > > `

> > >     %
> > >     % Adobe Sabon
> > >     %
> > >     \usetypescriptfile[type-buy]
> > >     \loadmapfile[texnansi-adobe-sabon.map]

> > >     \starttypescript [serif] [sabon, sabon-oldstyle] [texnansi]
> > >       \definefontsynonym [Sabon-Roman]          [texnansi-sar]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold]           [texnansi-sab]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Italic]         [texnansi-sai]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-Italic]    [texnansi-sabi] [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Roman-SmallCaps][texnansi-sarsc]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Italic-OSF]     [texnansi-saiof]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-OSF]       [texnansi-sabof]  [encoding=texnansi]
> > >       \definefontsynonym [Sabon-Bold-Italic-OSF][texnansi-sabio]  [encoding=texnansi]
> > >     \stoptypescript

> > >     \starttypescript [serif] [sabon] [name]
> > >       \usetypescript[serif][fallback]
> > >       \definefontsynonym [Serif]           [Sabon-Roman]
> > >       \definefontsynonym [SerifBold]       [Sabon-Bold]
> > >       \definefontsynonym [SerifItalic]     [Sabon-Italic]
> > >       \definefontsynonym [SerifBoldItalic] [Sabon-Bold-Italic]
> > >       \definefontsynonym [SerifCaps]       [Sabon-Roman-SmallCaps]
> > >       % the regular old-style figures are in the small-caps file
> > >       \definefontsynonym [OldStyle]        [Sabon-Roman-SmallCaps]
> > >     \stoptypescript

> > >     \starttypescript [Sabon]
> > >       \definetypeface [Sabon] [rm] [serif] [sabon] [default] [encoding=texnansi]
> > >     \stoptypescript

> > >     \starttypescript [serif] [sabon-oldstyle] [name]
> > >       \usetypescript[serif][fallback]
> > >       \definefontsynonym [Serif]           [Sabon-Roman]
> > >       \definefontsynonym [SerifBold]       [Sabon-Bold-OSF]
> > >       \definefontsynonym [SerifItalic]     [Sabon-Italic-OSF]
> > >       \definefontsynonym [SerifBoldItalic] [Sabon-Bold-Italic-OSF]
> > >       \definefontsynonym [SerifCaps]       [Sabon-Roman-SmallCaps]
> > >       % the regular old-style figures are in the small-caps file
> > >       \definefontsynonym [OldStyle]        [Sabon-Roman-SmallCaps]
> > >     \stoptypescript

> > >     \starttypescript [SabonOldStyle]
> > >       \definetypeface [SabonOldStyle] [rm] [serif] [sabon-oldstyle] [default] [encoding=texnansi]
> > >     \stoptypescript

> > > `

> > Then we can see our old-style figures:

> > > `

> > >     \usetypescriptfile[type-sabon]
> > >     \usetypescript[SabonOldStyle]
> > >     \setupbodyfont[SabonOldStyle]

> > >     \starttext
> > >     This is Sabon roman 0123456789,
> > >     old-style \os 0123456789,
> > >     {\it italic 0123456789,}
> > >     {\bf bold 0123456789,}
> > >     and {\bi bold-italic 0123456789.}

> > >     {\em \bf This is also bold-italic 0123456789.}

> > >     \stoptext

> > > `

> > Note that the usage is a bit inconsistent: bold and italic use old-style figures by default and do not require `\os`, but the regular font uses the standard "lining" figures and does require `\os` for the old-style figures. It would be more consistent to make old-style the default for the regular font, but we would need to make a virtual font to do that. (Reason: the regular old-style figures are contained in the small-caps font file. Virtual fonts allow us to assemble portions of existing font files into a new "view").

> > Using the scheme shown here, if we want both lining and old-style figures in bold or italic, we have to use both typefaces and switch between them as necessary.

> > This example does not provide any math mode definitions.

> ### TrueType

## Typography

I use TeX to typeset books for print publication. Just as I am a beginning TeX user, so am I a beginning typographer and book designer (but a very serious one).

My interest is in traditional forms suitable for novels and the like. All the examples I give below are intended for that use. I have generally followed the advice given by these authors:

- Robert Bringhurst, The Elements of Typographic Style
- Jan Tschichold, The Form of the Book
- Geoffrey Dowding, Finer Points in the Spacing & Arrangement of Type

> ### Tight word spacing

> Do not insert extra space at the end of sentences. Use small paragraph indententation and do not use vertical spacing between parapgraphs.

> In plain TeX, tight spacing at the end of sentences is called `\frenchspacing`.

> > `

> >     \setupspacing[packed]   % normal word space at the end of sentences
> >     \setupindenting[small]  % small paragraph indent; about 1em?
> >     \setupwhitespace[none]  % no space between paragraphs

> > `

> ### Indenting

> You can bring in the margins for a quotation or extract with `\startnarrower ... \stopnarrower`. The amount of indentation is in predefined units which are established separately for the left, right, and middle (which does both left and right by the same amount). For example, I could do something like:

> > `\setupnarrower[left=4em,right=2in,middle=3cm]`

> And then:

> > `

> >     \startnarrower[3*left]   % indents left margin 12em
> >     \startnarrower[right]    % indents right margin 2 inches
> >     \startnarrower[2*middle] % indents both margins 6 cm

> > `

> The manual shows how to combine parameters.

> `\startnarrower` without parameters is the same as `\startnarrower[middle]`.

> There is a reasonable default indentation size, but I don't know its exact dimension.

> ### Using smaller symbols

> Dowding says that "&" can be substituted for "and" wherever doing so improves the page. This is not a license to globally replace all such occurances; I use the technique only as a last resort to eliminate an overfull box.

> In the fonts I have used the full-height "&" seems too large in body text, so I use a smaller version:

> > `\def\Ampersand{{\tfx \&}}`

> The italic "&" is often a fancier glyph and might be useful; or it might be too fancy for body text use. I would use the italic version in Computer Modern, but the regular glyph in Adobe Sabon.

> I also think the full-size "$" is too big in body text, and use a reduced version:

> > `\def\Dollar{{\tfx \$}}`

> ### Dashes

> The em-dash is too wide. Use a spaced en-dash instead: "`--` ". Depending on the context, it might be necessary to use a non-breaking space (~) on either side to prevent an unwanted line break.

> ### Letterspacing capitals and small caps

> The experts say that strings of uppercase and small-cap words should be slightly letterspaced. I find that a very little spacing is "plenty." Sometimes it does not look right at all, and I omit it. Note that it is an offence against typography to letterspace lowercase letters.

> Since getting a tip from Hans Hagen, I have used these macros:

> > `

> >     \def\CapStretchAmount{.08em}
> >     \def\CapStretch#1{\def\stretchedspaceamount{\CapStretchAmount}\stretchednormalcase{#1}}

> > `

> Which is used as so:

> > `\CapStretch{\sc The King in Yellow}`

> ### Margin kerning: Hanging punctuation and protruding characters

> The typography references say that a justified margin does not look "optically" straight when the characters are "mechanically" aligned to that margin, because some characters are too light to color the margin. The margin looks straighter if they are pushed farther into it.

> I have seen very few examples of this technique in the real world (other than photos of Gutenberg's Bible) so it is hard to judge its proper use. Experimentation and considered judgement are required.

> The technique is supported by pdfTeX and ConTeXt. See Hàn Thê Thành's dissertation: Micro-typographic extensions to the TEX typesetting system, and Fonts in ConTeXt (`mfonts.pdf`).

> Note that in TeX the technique does not merely stretch the whitespace between words; it actually enters into the line-breaking algorithm and can greatly alter a paragraph's setting.

> ConTeXt comes with a couple of prededefined settings. You can see the definitions in `type-exa.tex` and `hang-def.tex`. To move the small puncuation marks a full em into the margin, use:

> > `\usetypescript [serif,sans,mono] [hanging] [pure]`

> To use a slightly less drastic style which also shifts alphabetic characters very slightly, use:

> > `\usetypescript [serif,sans,mono] [hanging] [thanh]`

> Margin kerning is enabled with something like:

> > `

> >     \usetypescript [serif,sans,mono] [hanging] [thanh]
> >     \usetypescriptfile[type-sabon]
> >     \usetypescript[Sabon]
> >     \setupbodyfont[Sabon]
> >     \setupalign[hanging]

> > `

> Important: The case for the default font, Computer Modern, is more complicated. Hanging alignment must be defined before the font is loaded, but Computer Modern is loaded before our definitions. The solution is to load it again after the definitions:

> > `

> >     \setupfontsynonym[cmr10][handling=pure]
> >     \setupfontsynonym[Serif][handling=pure]
> >     \setupfonthandling[normal][left=1,right=1]
> >     \usetypescript[cmr]
> >     \setupbodyfont[10pt]

> > `

> You can customize your own settings. In fact, different fonts need different settings. For example, I added these lines to my `type-sabon.tex` file (stolen from `hang-def.tex`, still to be adapted):

> > `

> >     \startfonthandling [sabon]

> >       \defineprotrudefactor !  0  .2
> >       \defineprotrudefactor '  0  .7
> >       \defineprotrudefactor ` .7   0
> >       \defineprotrudefactor ( .05  0
> >       \defineprotrudefactor )  0  .05
> >       \defineprotrudefactor [ .05  0
> >       \defineprotrudefactor ]  0  .05
> >       \defineprotrudefactor ,  0  .7
> >       \defineprotrudefactor -  0  .7
> >       \defineprotrudefactor .  0  .7
> >       \defineprotrudefactor :  0  .5
> >       \defineprotrudefactor ;  0  .5

> >       \defineprotrudefactor rightupperninequote  0 .5
> >       \defineprotrudefactor leftupperninequote  .5  0
> >       \defineprotrudefactor endash               0 .3
> >       \defineprotrudefactor emdash               0 .2

> >       \defineprotrudefactor hyphen               0 .7

> >       \defineprotrudefactor A .05 .05
> >       \defineprotrudefactor F  0  .05
> >       \defineprotrudefactor J .05   0
> >       \defineprotrudefactor K  0  .05
> >       \defineprotrudefactor L  0  .05
> >       \defineprotrudefactor T .05 .05
> >       \defineprotrudefactor V .05 .05
> >       \defineprotrudefactor W .05 .05
> >       \defineprotrudefactor X .05 .05
> >       \defineprotrudefactor Y .05 .05

> >       \defineprotrudefactor k  0  .05
> >       \defineprotrudefactor r  0  .05
> >       \defineprotrudefactor t  0  .05
> >       \defineprotrudefactor v .05 .05
> >       \defineprotrudefactor w .05 .05
> >       \defineprotrudefactor x .05 .05
> >       \defineprotrudefactor y .05 .05

> >       % accented chars omitted from this example

> >     \stopfonthandling

> >     \starttypescript [serif] [hanging] [sabon]
> >       \setupfontsynonym [Serif]            [handling=sabon]
> >       % not handling these yet
> >       %\setupfontsynonym [SerifBold]        [handling=bold]
> >       %\setupfontsynonym [SerifSlanted]     [handling=slanted]
> >       %\setupfontsynonym [SerifItalic]      [handling=italic]
> >       %\setupfontsynonym [SerifBoldSlanted] [handling=boldslanted]
> >       %\setupfontsynonym [SerifBoldItalic]  [handling=bolditalic]
> >     \stoptypescript

> > `

> Using these custom settings is just a matter of:

> > `

> >     \usetypescriptfile[type-sabon]
> >     \usetypescript [serif] [hanging] [sabon]
> >     \usetypescript[Sabon]
> >     \setupbodyfont[Sabon]
> >     \setupalign[hanging]

> > `

Comments?