/onesuperior/ordmasculine/guillemotright
/onequarter/onehalf/threequarters
/questiondown/Agrave/Aacute/Acircumflex
/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave
/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
/Icircumflex/Idieresis/Eth/Ntilde/Ograve
/Oacute/Ocircumflex/Otilde/Odieresis/multiply
/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis
/Yacute/Thorn/germandbls/agrave/aacute
/acircumflex/atilde/adieresis/aring/ae
/ccedilla/egrave/eacute/ecircumflex/edieresis
/igrave/iacute/icircumflex/idieresis/eth
/ntilde/ograve/oacute/ocircumflex/otilde
/odieresis/divide/oslash/ugrave/uacute
/ucircumflex/udieresis/yacute/thorn
/ydieresis]
>> endobj
5 0 obj <<
/Type /Font
/Subtype /Type1
/Encoding 7 0 R
/BaseFont /Times-Roman
>> endobj
6 0 obj <<
/Type /Pages
/Count 1
/Kids [2 0 R]
>> endobj
8 0 obj <<
/Type /Catalog
/Pages 6 0 R
>> endobj
9 0 obj <<
/Creator (TeX)
/Producer (pdfTeX-0.12r)
/CreationDate (D:19981205172300)
>> endobj
xref
0 10
0000000000 65535 f
0000000242 00000 n
0000000308 00000 n
0000000009 00000 n
0000000223 00000 n
0000002238 00000 n
0000002326 00000 n
0000000420 00000 n
0000002383 00000 n
0000002432 00000 n
trailer
<<
/Size 10
/Root 8 0 R
Hàn Thế Thành
/Info 9 0 R
>>
Sebastian Rahtz
startxref
Hans Hagen
2526
%%EOF
January 21, 2000
The pdfTEX user manual
%PDF-1.2
3 0 obj <<
/Length 4 0 R
>>
stream
1 0 0 1 91.925 759.924 cm
BT
/F51 9.963 Tf 0 0 Td[(W)80(elcome)-250(to)
-250(pdfT)]TJ 67.818 -2.241 Td[(E)]TJ 4.842
2.241 Td[(X!)]TJ 138.923 -654.744 Td[(1)]TJ
ET
endstream
endobj
4 0 obj
162
endobj
1 0 obj <<
/Font << /F51 5 0 R >>
/ProcSet [/PDF /Text]
>> endobj
2 0 obj <<
/Type /Page
/Contents 3 0 R
/Resources 1 0 R
/MediaBox [0 0 595.273 841.887]
/Parent 6 0 R
>> endobj
7 0 obj <<
/Type /Encoding
/Differences [ 0/.nothdef 5/dotaccent
/hungarumlaut/ogonek 8/.notdef 9/fraction
10/.notdef 11/ff/fi/fl/ffi/ffl/dotlessi
/dotlessj/grave/acute/caron/breve/macron
/ring/cedilla/germandbls/ae/oe/oslash/AE
/OE/Oslash/space/exclam/quotedbl/numbersign
/dollar/percent/ampersand/quoteright
/parenleft/parenright/asterisk/plus/comma
/hyphen/period/slash/zero/one/two/three/four
/five/six/seven/eight/nine/colon/semicolon
/less/equal/greater/question/at/A/B/C/D/E/F
/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z
/bracketleft/backslash/bracketright
/circumflex/underscore/quoteleft/a/b/c/d/e
/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
/braceleft/bar/braceright/tilde/dieresis
/Lslash/quotesingle/quotesinglbase/florin
/quotedblbase/ellipsis/dagger/daggerdbl
/circumflex/perthousand/Scaron/guilsinglleft
/OE/Zcaron/asciicircum/minus/lslash/quoteleft
/quoteright/quotedblleft/quotedblright/bullet
/endash/emdash/tilde/trademark/scaron
/guilsinglright/oe/zcaron/asciitilde
/Ydieresis/space/exclamdown/cent/sterling
/currency/yen/brokenbar/section/dieresis
/copyright/ordfeminine/guillemotleft
/logicalnot/hyphen/registered/macron/degree
/plusminus/twosuperior/threesuperior/acute
/mu/paragraph/periodcentered/cedilla
The pdfTEX manual
thanh@informatics.muni.cz — Hàn Thế Thành
s.rahtz@elsevier.co.uk — Sebastian Rahtz
pragma@wxs.nl — Hans Hagen
January 21, 2000
The title page of this manual
represents the plain TEX coded
text “Welcome to pdfTEX!”
=tir
The pdfTEX user manual
Contents
1
2
3
4
5
6
7
8
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
About PDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Macro packages supporting PDFTEX . . . . . 10
Setting up fonts . . . . . . . . . . . . . . . . . . . . . . . . 11
Formal syntax specification . . . . . . . . . . . . . 16
New primitives . . . . . . . . . . . . . . . . . . . . . . . . . 18
Graphics and color . . . . . . . . . . . . . . . . . . . . . 28
Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1 Introduction
The main purpose of the pdfTEX project was to create an extension of TEX that can create pdf directly
from TEX source files and improve/enhance the result of TEX typesetting with the help of pdf. When pdf
output is not selected, pdfTEX produces normal dvi output, otherwise it produces pdf output that looks
identical to the dvi output. An important aspect of this project is to investigate alternative justification
algorithms, optionally making use of multiple master fonts.
pdfTEX is based on the original TEX sources and Web2c, and has been successfully compiled on Unix,
Win32 and MSDos systems. It is still under beta development and all features are liable to change.
Despite its β--state, pdfTEX produces excellent pdf code.
As pdfTEX evolves, this manual will evolve and more background information will be added. Be patient
with the authors.
This manual is typeset in ConTEXt. One can generate an A4 version from the source code by saying:
An letter size variant is also supported:
Given that the A4 version is typeset, one can generate a booklet by saying:
This also demonstrates that pdfTEX can be used for page imposition purposes (given that pdfTEX and
the fonts are set up all right).
We thank all readers who send us corrections and suggestions. We also wish to express the hope that
pdfTEX will be of as much use to you as it is to us. Since pdfTEX is still being improved and extended,
we suggest you keep track of updates.
2 About PDF
The cover of this manual shows a simple pdf file. Unless compression and/or encryption is applied,
such a file is rather verbose and readable. The first line specifies the version used; currently pdfTEX
produces level 1.2 output. Viewers are supposed to silently skip over all elements they cannot handle.
A pdf file consist of objects. These objects can be recognized by their number and keywords:
1
The pdfTEX user manual
Here
is the object capsule. The first number is the object number. Later we will
see that pdfTEX gives access to this number. One can for instance create an object by using
after which
returns the number. So
inserts an object into the file, while
returns the number pdfTEX assigned to this object.
The sequence
is an object reference, a pointer to another object. The second number (here a zero)
is currently not used in pdfTEX; it is the version number of the object. It is for instance used by pdf
editors, when they replace objects by new ones.
In general this rather direct way of pushing objects in the files is rather useless and only makes sense
when implementing for instance fill--in field support or annotation content reuse. We will come to that
later. Unless such direct objects are part of something larger, they will end up as isolated entities, not
doing any harm but not doing any good either.
When a viewer opens a pdf file, it first goes to the end of the file. There it finds the keyword
,
the signal where to look for the so called ‘object cross reference table’. This table provides fast access to
the objects that make up the file. The actual starting point of the file is defined after the
. The
entry points to the catalog. In this catalog the viewer can find the page list. In our example we
have only one page. The trailer also holds an
entry, which tells a bit more about the document.
Just follow the thread:
−→ object 8 −→
−→ object 6 −→
−→ object 2 −→ page content
As soon as we add annotations, a fancy word for hyperlinks and alike, some more entries are present in
the catalog. We invite users to take a look at the pdf code of this file to get an impression of that.
The page content is a stream of drawing operations. Such a stream can be compressed, where the level
of compression can be set with
. Let’s take a closer look at this stream. First there
is a transformation matrix, six numbers followed by . As in PostScript, the operator comes after the
operands. Between
and
comes the text. A font switch can be recognized as
. The actual text
goes between
so that it creates a PostScript string. When one analyzes a file produced by a less
sophisticated typesetting engine, whole sequences of words can be recognized. In TEX however, the text
comes out rather fragmented, mainly because a lot of kerning takes place. Because viewers can search
in these streams, one can imagine that the average TEX produced files becomes more difficult as soon as
the typesetting engine does a better job; TEX cannot do less.
This one page example uses an Adobe Times Roman font. This is one of the 14 fonts that is always
present in the viewer application, and is called a base font. However, when we use for instance Computer
Modern Roman, we have to make sure that this font is available, and the best way to do this is to embed
it in the file. Just let your eyes follow the object thread and see how a font is described. The only thing
missing in this example is the (partially) embedded glyph description file, which for the base fonts is
not needed.
In this simple file, we don’t specify in what way the file should be opened, for instance full screen or
clipped. A closer look at the page object (
) shows that a mediabox is part of the page
2
The pdfTEX user manual
description. A mediabox acts like the bounding box in a PostScript file. pdfTEX users have access to
this object by
.
Although in most cases macro packages will shield users from these internals, pdfTEX provides access
to many of the entries described here, either automatically by translating the TEX data structures into
pdf ones, or manually by pushing entries to the catalog, page, info or self created objects. Those who,
after this introduction, feel uncomfortable in how to proceed, are advised to read on but skip section 7.
Before we come to that section, we will describe how to get started with pdfTEX.
3 Getting started
This section describes the steps needed to get pdfTEX running on a system where pdfTEX is not yet
installed. Some TEX distributions have pdfTEX as a component, like teTEX, fpTEX, MikTeX and CMacTEX,
so when you use one of them, you don’t need to bother with the pdfTEX installation. Note that the
installation description in this manual is Web2c--specific.
For some years there has been a ‘moderate’ successor to TEX available, called e-TEX. Because the main
stream macro packages start supporting this welcome extension, pdfTEX also is available as pdfe-TEX.
Although in this document we will speak of pdfTEX, we advise users to use pdfe-TEX when available.
That way they get the best of all worlds and are ready for the future.
3.1
Getting sources and binaries
The latest sources of pdfTEX are distributed together with precompiled binaries of pdfTEX for some
platforms, including Linux 1 , SGI IRIX, Sun SPARC Solaris and MSDos (djgpp). 2 The primary location
where one can fetch the source code (by version) is:
Thomas Esser’s teTEX distribution comes with precompiled versions for many Unix systems. More
information can be found at:
. For Win32 systems (Windows 95, Windows
NT) there are two packages that contain pdfTEX, both in
: fpTEX, maintained by
Fabrice Popineau,
, and MikTeX by Christian Schenk,
.
3.2
Compiling
If there is no precompiled binary of pdfTEX for your system, you need to build pdfTEX from sources.
The compilation is expected to be easy on Unix--like systems and can be described best by example.
Assuming that all needed files are downloaded to
, on a Unix system the following steps
are needed to compile pdfTEX:
1
2
The Linux binary is compiled for the new
(gnu
based on
.
The djgpp version is built by djgpp 2.0 cross--compiler on Linux.
3
), which will not run for users of older Linux installations still
The pdfTEX user manual
If you happen to have a previously configured source tree and just install a new version of pdfTEX, you
can avoid running
from the top--level directory. It’s quicker to run
, which
will just regenerate the
’s based on
:
For Unix users the savest way to generate binaries is to get the latest teTEX and follow the instructions
that come with it.
Apart from the binary of pdfTEX the compilation also produces several other files which are needed for
running pdfTEX:
The pool file, needed for creating formats, located in
Web2c run--time configuration file, located in
An external program to generate afm files from TrueType fonts, located in
Precompiled binaries are included in the zip archive
3.3
.
Getting PDFTEX--specific platform--independent files
Apart from the above--mentioned files, there is another zip archive (
distribution which contains platform--independent files required for running pdfTEX:
•
•
•
•
configuration file:
encoding vectors:
map files:
macros:
Unpacking this archive —don’t forget the
containing pdfTEX--specific files.
3.4
) in the pdfTEX
option when using
— will create a
tree
Placing files
The next step is to place the binaries somewhere in
make a copy (or symbolic link) of
and name it
4
. If you want to use LATEX, you also need to
. The files
and
The pdfTEX user manual
and the directory
, created by unpacking the file
‘appropriate’ place (see below).
3.5
, should be moved to the
Setting search paths
Web2c--based programs, including pdfTEX, use the Web2c run--time configuration file called
.
This file can be found via the user--set environment variable
or via the compile--time default
value if the former is not set. It is strongly recommended to use the first option. Next you need to
edit
so pdfTEX can find all necessary files. Usually one has to edit
and maybe some
of the next variables. When running pdfTEX, some extra search paths are used beyond those normally
requested by TEX itself:
used for
format
virtual fonts
type1 fonts
truetype fonts
pgc fonts
pdftex.cfg
images
map files
encoding files
kpse
kpse
kpse
kpse
kpse
kpse
kpse
kpse
texmf.cnf
vf format
type1 format
truetype format
miscfonts format
tex format
tex format
tex ps header format
tex ps header format
Table 1 The Web2c variables.
Virtual fonts are fonts made up of others and
files play an important role in this
process. Because pdfTEX produces the final output code, it must consult those files.
Outline (vector) fonts are to be prefered over bitmap pk fonts. In most cases Type 1
fonts are used and this variable tells pdfTEX where to find them.
Like Type 1 fonts, TrueType fonts are also outlines.
pdfTEX is able to read so called
files. These contain fonts
descriptions in pdf format. (A separate manual will be made available soon.)
Unfortunately bitmap fonts are displayed poorly by pdf viewers, so when possible
one should use outline fonts. When no outline is available, pdfTEX tries to locate a
suitable pk font (or invoke a process that generates them).
This variable specifies where pdfTEX finds its configuration file and input files. Being
a postprocessor too, image files are considered input files and searched for along
this path.
This is the path where pdfTEX looks for the font mapping files (
) and encoding
files (
). Both types provide pdfTEX the information needed for embedding font
encoding vectors and font resources.
5
The pdfTEX user manual
3.6
The PDFTEX configuration file
One has to keep in mind that, opposed to dvi output, there is no postprocessing stage. This has several
rather fundamental consequences, like one--pass graphic and font inclusion. When TEX builds a page,
the macro package used quite certain has a concept of page dimensions, which is not the same as paper
dimensions. The reference point of the page is the top--left corner.
Most dvi postprocessors enable the user to specify the paper size, which often defaults to ‘A4’ or ‘letter’.
In most cases it does not harm that much to mix the two, because one will seldom put too small paper
in the printer. And, if one does, one will certainly not do that a second time. In pdf the paper size is
part of the definition. This means that everything that is off page, is clipped off, it simply disappears.
Even worse, just like in a PostScript file, the reference point is in the lower corner, which is opposite
to dvi’s reference point.
And so, we’ve found one of the main reasons why pdfTEX explicitly needs to know the paper dimensions.
These dimensions can either be passed using the so called configuration file, or by using the primitives
provided for this purpose. In this respect, the pdfTEX configuration file can be compared to configuration
files that come with dvi postprocessors and/or command line options. Both contain information on the
paper used, the fonts to be included and optimizations to be applied.
When pdfTEX is run in ini--mode, which is normally the case when we generate a format file, the configuration file is not read at all, and all configuration parameters are set to 0 by default for both integer
and dimension parameters.
When pdfTEX is launched in non--ini mode, it reads the Web2c configuration file as well as the pdfTEX
configuration file called
, searched for in the
path. As Web2c systems commonly
specify a ‘private’ tree for pdfTEX where configuration and map files are located, this allows individual
users or projects to maintain customized versions of the configuration file. The configuration file must
exist when pdfTEX is run (except when generating a format).
The integer configuration parameters replace the corresponding internal ones just before pdfTEX starts
reading the input file. At this moment the format is already loaded, so any former settings during
creating formats will be overwritten by the values from config file. So, unless the macro package used
resets
, pdfTEX will produce pdf output! Macros (packages) that adapt themselves to either
dvi (using specials) or pdf (dedicated primitives) should be aware of this.
When at the moment the first page is shipped out
has positive value, the configuation
parameters that are dimension overwrite only the corresponding internal ones that are 0. The value of
cannot be changed after the first page has been shipped out.
Most parameters in the configuration file have a corresponding internal register. When not set during
the TEX run, pdfTEX uses the values as specified in the configuration file.
Apart from the above described parameters, the configuration file can have another entry named
.
This entry specifies the font mapping files, which is similar to those used by many dvi to PostScript
drivers. More than one map file can be specified, using multiple
lines. If the name of the map file is
prefixed with a , its values are appended to the existing set, otherwise they replace it. If no map files
are given, the default value
is used.
6
The pdfTEX user manual
internal name
parameters
type
output format
integer
adjust spacing level integer
compress level
integer
decimal digits
integer
move chars
integer
image resolution
integer
pk resolution
integer
horigin
dimension
vorigin
dimension
dimension
page height
page width
dimension
link margin
dimension
thread margin
dimension
Figure 1 The configuration parameters.
A typical
file looks like this, setting up output for A4 paper size and the standard TEX offset
of 1 inch, and loading two map files for fonts:
The configuration file sets default values for these parameters, and apart from the
entry, they all can
be over--ridden in the TEX source file. Dimensions can be specified as
, which makes them immune
for magnification (when set).
output format This integer parameter specifies whether the output format should be dvi or pdf. A
positive value means pdf output, otherwise we get dvi output.
compress level This integer parameter specifies the level of text and in--line graphics compression.
pdfTEX uses zip compression as provided by
. A value of 0 means no compression, 1 means fastest,
9 means best, 2..8 means something in between. Just set this value to 9, unless there is a good reason
to do otherwise — 0 is great for testing macros that use
.
7
The pdfTEX user manual
decimal digits This integer specifies the preciseness of real numbers in pdf page descriptions. It gives
the maximal number of decimal digits after the decimal point of real numbers. Valid values are in range
0..5. A higher value means more precise output, but also results in a much larger file size and more time
to display or print. In most cases the optimal value is 2. This parameter does not influence the precision
of numbers used in raw pdf code, like that used in
and annotation action specifications.
image resolution When pdfTEX is not able to determine the natural dimensions of an image, it assumes
a resolution of type 72 dots per inch. Use this variable to change this default value.
pk resolution One can use this entry to specify the resolution for bitmap fonts. Nowadays most
printers are capable to print at least 600 dots per inch, so this is a reasonable default.
move chars Although pdf output is claimed to be portable, especially when all font information is
included in the file, problems with printing and viewing have a persistent nature. Moving the characters
in range 0-31 sometimes helps a lot. When set to 1, characters are only moved when a font has less than
128 glyphs, when set to 2 higher slots are used too.
page width & page height These two dimension parameters specify the output medium dimensions
(the paper, screen or whatever the page is put on). If they are not specified, the page width is calculated
as wbox being shipped out + 2 × (horigin +
). The page height is calculated in a similar way.
horigin & vorigin These dimension parameters can be used to set the offset of the TEX output box
from the top left corner of the ‘paper’.
map This entry specifies the font mapping file, which is similar to those used by many dvi to PostScript
drivers. More than one map file can be specified, using multiple
lines. If the name of the map file is
prefixed with a , its values are appended to the existing set, otherwise they replace it. If no map files
are given, the default value
is used.
3.7
Creating formats
Formats for pdfTEX are created in the same way as for TEX. For plain TEX and LATEX it looks like:
In ConTEXt the generation depends on the interface used. A format using the english user interface is
generated with
When properly set up, one can also use the ConTEXt command line interface TEXexec to generate one
or more formats, like:
for an english format, or
8
The pdfTEX user manual
for an english and german one, using pdfe-TEX. Indeed, if there is pdfTEX as well as pdfe-TEX, use it!
Whatever macro package used, the formats should be placed in the
path. We strongly
recommend to use pdfe-TEX, if only because the main stream macro packages (will) use it.
3.8
Testing the installation
When everything is set up, you can test the installation. In the distribution there is a plain TEX test file
. Process this file by saying:
If the installation is ok, this run should produce a file called
a good place to look for how to use pdfTEX’s new primitives.
3.9
. The file
is also
Common problems
The most common problem with installations is that pdfTEX complains that something cannot be found.
In such cases make sure that
is set correctly, so pdfTEX can find
. The next best
place to look/edit is the file
. When still in deep trouble, set
before
running pdfTEX or run pdfTEX with option
. This will cause pdfTEX to write a lot of debugging
information that can be useful to trace problems. More options can be found in the Web2c documentation.
Variables in
can be overwritten by environment variables. Here are some of the most common
problems you can encounter when getting started:
•
is not set correctly and so pdfTEX cannot find
contain a path to the pool file
or
, or
in
when you use pdfe-TEX.
doesn’t
•
pdfTEX cannot find
and must be increased. If
, or the value of
is not specified in
specified in
is not large enough
then you can add something like
•
Format is not created (see above how to do that) or is not properly placed. Make sure that
in
contains the path to
or
.
•
This appears if you forgot to regenerate the
binary and
.
files after installing a new version of the pdfTEX
9
The pdfTEX user manual
•
This might appear if you forgot to install the proper
the pdfTEX binary.
when installing a new version of
• pdfTEX cannot find the configuration file
, one or more map files (
tors (
), virtual fonts, Type 1 fonts, TrueType fonts or some image file.
Make sure that the required file exists and the corresponding variable in
to the file. See above which variables pdfTEX needs apart from the ones TEX uses.
), encoding veccontains a path
Normally the page content takes one object. This means that one seldom finds more than a few hundred
objects in a simple file. This document for instance uses about 300 objects. In demanding applications
this number can grow quite rapidly, especially when one uses a lot of widget annotations, shared annotations or other shared things. In these situations in
one can enlarge pdfTEX’s internal
object table by adding a line in
, for instance:
4 Macro packages supporting PDFTEX
When producing dvi output, for which one can use pdfTEX as well as any other TEX, part of the job
is delegated to the dvi postprocessor, either by directly providing this program with commands, or
by means of
. Because pdfTEX directly produces the final format, it has to do everything
itself, from handling color, graphics, hyperlink support, font--inclusion, upto page imposition and page
manipulation.
As a direct result, when one uses a high level macro package, the macros that take care of these features have to be set up properly. Specials for instance make no sense at all. Actually being a comment
understood by dvi postprocessors —given that the macro package speaks the specific language of this
postprocessor— a
would end up as just a comment in the pdf file, which is of no use. Therefore,
issues a warning when pdfTEX is in pdf mode.
When one wants to get some insight to what extend pdfTEX specific support is needed, one can start a
file by saying:
or, if this leads to confusion,
And see what happens. As soon as one ‘special’ message turns up, one knows for sure that some kind
of pdfTEX specific support is needed, and often the message itself gives a indication of what is needed.
Currently all main stream macro packages offer pdfTEX support in one way or the other. When using
such a package, it makes sense to turn on this support in the appropriate way, otherwise one cannot be
sure if things are set up right. Remember that for instance the page and paper dimensions have to be
taken care of, and only the macro package knows the details.
10
The pdfTEX user manual
• For LATEX users, Sebastian Rahtz’
package has substantial support for pdfTEX, and provides
access to most of its features. In the simplest case, the user merely needs to load
with
a
option, and all cross--references will be converted to pdf hypertext links. pdf output is
automatically selected, compression is turned on, and the page size is set up correctly. Bookmarks
are created to match the table of contents.
• The standard LATEX
and
packages have
color, text rotation, and graphics inclusion commands.
options, which allow use of normal
• The ConTEXt macro package by Hans Hagen (pragma@wxs.nl) has very full support for pdfTEX in its
generalized hypertext features. Support for pdfTEX is implemented as a special driver, and is invoked
by saying
or feeding TEXexec with the
option.
• Hypertexted pdf from
modification of the standard
documents can be created with
, which is a slight
macros. This file is part of the pdfTEX distribution.
• A similar modification of
, called
, allows production of hypertext’d pdf
versions of programs written in web. This is also part of the pdfTEX distribution.
Some nice samples of pdfTEX output can be found on the tug web server, at
and
.
5 Setting up fonts
pdfTEX can work with Type 1 and TrueType fonts, but a source must be available for all fonts used
in the document, except for the 14 base fonts supplied by Acrobat Reader (Times, Helvetica, Courier,
Symbol and Dingbats). It is possible to use METAFONT--generated fonts in pdfTEX— but it is strongly
recommended not to use METAFONT--fonts if an equivalent is available in Type 1 or TrueType format,
if only because bitmap Type 3 fonts render very poorly in Acrobat Reader. Given the free availability
of Type 1 versions of all the Computer Modern fonts, and the ability to use standard PostScript fonts,
most TEX users should be able to experiment with pdfTEX.
5.1
Map files
pdfTEX reads the map files, specified in the configuration file, see section 3.6, in which reencoding and
partial downloading for each font are specified. Every font needed must be listed, each on a separate
line, except pk fonts. The syntax of each line is similar to
map files 3 and can contain up to the
following (some are optional) fields: texname, basename, fontflags, fontfile, encodingfile and special.
The only mandatory is texname and must be the first field. The rest is optional, but if basename is
given, it must be the second field. Similarly if fontflags is given it must be the third field (if basename
is present) or the second field (if basename is left out). It is possible to mix the positions of fontfile,
encodingfile and special, however the first three fields must be given in fixed order.
texname sets the name of the tfm file. This name must be given for each font.
3
map files can be used with pdfTEX without problems.
11
The pdfTEX user manual
basename sets the base (PostScript) font name. If not given then it will be taken from the font file.
Specifying a name that doesn’t match the name in the font file will cause pdfTEX to write a warning, so it
is best not to have this field specified if the font resource is available, which is the most common case.
This option is primarily intended for use of base fonts and for compatibility with
map files.
fontflags specify some characteristics of the font. The next description of these flags are taken, with
a slight modification, from the pdf Reference Manual (the section on Font Descriptor Flags).
The value of the flags key in a font descriptor is a 32--bit integer that contains a collection of
boolean attributes. These attributes are true if the corresponding bit is set to 1. Table 2 specifies
the meanings of the bits, with bit 1 being the least significant. Reserved bits must be set to zero.
bit position
1
2
3
4
5
6
7
8–16
17
18
19
20–32
semantics
Fixed--width font
Serif font
Symbolic font
Script font
Reserved
Uses the Adobe Standard Roman Character Set
Italic
Reserved
All--cap font
Small--cap font
Force bold at small text sizes
Reserved
Table 2 The meaning of flags in the font descriptor.
All characters in a fixed--width font have the same width, while characters in a proportional font
have different widths. Characters in a serif font have short strokes drawn at an angle on the
top and bottom of character stems, while sans serif fonts do not have such strokes. A symbolic
font contains symbols rather than letters and numbers. Characters in a script font resemble
cursive handwriting. An all--cap font, which is typically used for display purposes such as titles
or headlines, contains no lowercase letters. It differs from a small--cap font in that characters in
the latter, while also capital letters, have been sized and their proportions adjusted so that they
have the same size and stroke weight as lowercase characters in the same typeface family.
Bit 6 in the flags field indicates that the font’s character set conforms the Adobe Standard Roman
Character Set, or a subset of that, and that it uses the standard names for those characters.
Finally, bit 19 is used to determine whether or not bold characters are drawn with extra pixels even
at very small text sizes. Typically, when characters are drawn at small sizes on very low resolution
devices such as display screens, features of bold characters may appear only one pixel wide.
Because this is the minimum feature width on a pixel--based device, ordinary non--bold characters
also appear with one--pixel wide features, and cannot be distinguished from bold characters. If
bit 19 is set, features of bold characters may be thickened at small text sizes.
12
The pdfTEX user manual
If the font flags are not given, pdfTEX treats it as being 4, a symbolic font. If you do not know the correct
value, it would be best not to specify it, as specifying a bad value of font flags may cause troubles in viewers. On the other hand this option is not absolutely useless because it provides backward compatibility
with older map files (see the fontfile description below).
fontfile sets the name of the font source file. This must be a Type 1 or TrueType font file. The font file
name can be preceded by one or two special characters, which says how the font file should be handled.
• If it is preceded by a the font file will be partly downloaded, which means that only used glyphs
(characters) are embedded to the font. This is the most common use and is strongly recommended
for any font, as it ensures the portability and reduces the size of the pdf output. Partial fonts are
included in such a way that name and cache clashes are minimalized.
• In case the font file name is preceded by a double
, the font file will be included entirely — all
glyphs of the font are embedded, including the ones that are not used in the document. Apart from
causing large size pdf output, this option may cause troubles with TrueType fonts too, so it is not
recommended. It might be useful in case the font is untypical and can not be subsetted well by
pdfTEX. Beware: some font vendors forbid full font inclusion.
• In case nothing preceded the font file name, the font file is read but nothing is embedded, only the
font parameters are extracted to generate the so--called font descriptor, which is used by Acrobat
Reader to simulate the font if needed. This option is useful only when you do not want to embed
the font (i.e. to reduce the output size), but wish to use the font metrics and let Acrobat Reader
generate instances that look close to the used font in case the font resource is not installed on the
system where the pdf output will be viewed or printed. To use this feature the font flags must be
specified, and it must have the bit 6 set on, which means that only fonts with the Adobe Standard
Roman Character Set can be simulated. The only exception is in case of Symbolic font, which is not
very useful.
• If the font file name is preceded by a , the font is not read at all, and is assumed to be available on
the system. This option can be used to create pdf files which do not contain embedded fonts. The
pdf output then works only on systems where the resource of the used font is available. It’s not very
useful for document exchange, as the pdf is not ‘portable’ at all. On the other hand it is very useful
when you wish to speed up running of pdfTEX during interactive work, and only in a final version
embed all used fonts. Don’t over--estimate gain in speed and when distributing files, always embed
the fonts! This feature requires Acrobat Reader to have access to installed fonts on the system. This
has been tested on Win95 and Unix (Solaris).
Note that the standard 14 fonts are never downloaded, even when they are specified to be downloaded
in map files. When one suffers from invalid lookups, for instance when pdfTEX tries to open a
file
instead of a
one, one can add the suffix to the filename. In this respect, pdfTEX completely relies
on the
libraries.
encoding specifies the name of the file containing the external encoding vector to be used for the font.
The file name may be preceded by a , but the effect is the same. The format of the encoding vector is
identical to that used by
. If no encoding is specified, the font’s built--in default encoding is used.
13
The pdfTEX user manual
It may be omitted if you are sure that the font resource has the correct built--in encoding. In general this
option is highly preferred and is required when subsetting a TrueType font.
special instructions can be used to manipulate fonts similar to the way
the keyword
is interpreted, other instructions are just ignored.
does. Currently only
If a used font is not present in the map files, first pdfTEX will look for a source with suffix
, which
4
is a so--called pgc source (pdf Glyph Container) . If no pgc source is available, pdfTEX will try to use
pk fonts in a normal way as dvi drivers do, on--the--fly creating pk fonts if needed.
Lines containing nothing apart from texname stand for scalable Type 3 fonts. For scalable fonts as
Type 1, TrueType and scalable Type 3 font, all the fonts loaded from a tfm at various sizes will be
included only once in the pdf output. Thus if a font, let’s say
, is described in one of the map
files, then it will be treated as scalable. As a result the font source for csr10 will be included only once
for
,
etc. So pdfTEX tries to do its best to avoid multiple downloading of identical
font sources. Thus vector pgc fonts should be specified as scalable Type 3 in map files like:
It doesn’t hurt much if a scalable Type 3 font is not given in map files, except that the font source will
be downloaded multiple times for various sizes, which causes a much larger pdf output. On the other
hand if a font is in the map files is defined as scalable Type 3 font and its pgc source is not scalable or
not available, pdfTEX will use pk font instead; the pdf output is still valid but some fonts may look ugly
because of the scaled bitmap.
A SlantFont is specified similarly as for
. A
or
must be used with embedding font file. Note that the base name, the PostScript name like Symbol or Times--Roman, cannot be
given, as pdfTEX never embeds a base font.
To summarize this rather confusing story, we include some sample lines. First we use a built--in font
with font--specific encoding, i.e. neither a download font nor an external encoding is given.
Use a built--in font with an external encoding. The
preceded encoding file may be left out.
Use a partially downloaded font with an external encoding:
4
This is a text file containing a pdf Type 3 font, created by METAPOST using some utilities by Hans Hagen. In general pgc files can
contain whatever allowed in pdf page description, which may be used to support fonts that are not available in METAFONT. At the
moment pgc fonts are not very useful, as vector Type 3 fonts are not displayed very well in Acrobat Reader, but it may be more
useful when Type 3 font handling gets better.
14
The pdfTEX user manual
Use some faked font map entries:
Use an ascii subset of OT1 and T1:
Download a font entirely without reencoding:
Partially download a font without reencoding:
Do not read the font at all — the font is supposed to be installed on the system:
Entirely download a font with reencoding:
Partially download a font with reencoding:
Sometimes we do not want to include a font, but need to extract parameters from the font file and
reencode the font as well. This only works for fonts with Adobe Standard Encoding. The font flags
specify how such a font looks like, so Acrobat Reader can generate similar instance if the font resource
is not available on the target system.
A TrueType font can be used in the same way as a Type 1 font:
5.2
TrueType fonts
As mentioned above, pdfTEX can work with TrueType fonts. Defining TrueType files is similar to Type 1
font. The only extra thing to do with TrueType is to create a tfm file. There is a program called
in the pdfTEX distribution which can be used to extract afm from TrueType fonts. Usage is simple:
15
The pdfTEX user manual
A TrueType file can be recognized by its suffix
. The optional encoding specifies the encoding, which
is the same as the encoding vector used in map files for pdfTEX and
. If the encoding is not given, all
the glyphs of the afm output will be mapped to
.
writes the output afm to standard
output. If we need to know which glyphs are available in the font, we can run
without encoding
to get all glyph names. The resulting afm file can be used to generate a tfm one by applying
.
To use a new TrueType font the minimal steps may look like below. We suppose that
included in
.
The PostScript font name (
onwards it may be left out.
) is reported by
is
, but from pdfTEX version 0.12l
There are two main restrictions with TrueType fonts in comparison with Type 1 fonts:
a. The special effects SlantFont/ExtendFont cannot be used.
b. To subset a TrueType font, the font must be specified as reencoded, therefore an encoding vector
must be given.
6 Formal syntax specification
This sections formaly specifies the pdfTEX specific extensions to the TEX macro programming language.
First we present some general definitions. All hgeneral texti is expanded immediately, like
in
traditional TEX, unless mentioned explicitly no to.
hgeneral texti → hfilleri
hbalanced texti hright bracei
hattr speci →
hgeneral texti
hobject type speci → [ hattr speci ]
| [ hattr speci ]
hresources speci →
hgeneral texti
hfile speci →
hgeneral texti
hpage speci →
hintegeri
haction speci →
huser-action speci |
hgoto-action speci |
hthread-action speci
hnewwindow speci →
|
huser-action speci →
hgeneral texti
hgoto-action speci → hnumidi |
[ hfile speci ] hnameidi |
[ hfile speci ] hpage speci hgeneral texti |
hfile speci hnameidi hnewwindow speci |
hfile speci hpage speci hgeneral texti hnewwindow speci
hnumidi →
hintegeri
hnameidi →
hgeneral texti
16
The pdfTEX user manual
hthread-action speci → [ hfile speci ] hnumidi | [ hfile speci ] hnameidi
hdest speci → hnumidi hdest typei | hnameidi hdest typei
hdest typei →
[
hintegeri ] |
|
|
|
|
|
hrule speci |
hid speci → hnumidi | hnameidi
pdfTEX introduces the following new primitives. Each primitive is prefixed by
and the extended
primitive.
(integer)
(integer)
(integer)
(integer)
(integer)
(dimension)
(dimension)
(dimension)
(dimension)
(tokens)
(tokens)
hgeneral texti
hgeneral texti [
haction speci ]
hgeneral texti
[ hfont speci ] [
hintegeri ] [
hintegeri ] [
(integer)
(integer)
hfonti (expandable)
hfonti (read--only integer)
hfonti hgeneral texti
[ hattr speci ] [ hresources speci ] hbox numberi
hintegeri
(read--only integer)
[ hrule speci ] [ hattr speci ] [ hpage speci ] hfile speci
hintegeri
(read--only integer)
(integer)
[ hrule speci ] hgeneral texti
(read--only integer)
hdest speci
[ hrule speci ] [ hattr speci ] haction speci
(dimension)
haction speci [
hintegeri ] hgeneral texti
17
except for
hintegeri ]
The pdfTEX user manual
hrule speci [ hattr speci ] hid speci
(dimension)
[
] hgeneral texti
[ hobject type speci ] hgeneral texti
(read--only integer)
hintegeri
(read--only integer)
(expandable)
7 New primitives
Here follows a short description of new primitives added by pdfTEX. One way to learn more about how
to use these primitives is to have a look at the file
in the pdfTEX distribution. Each pdfTEX
specific primitive is prefixed by
.
The parameters that are marked as default: from configuration take their value from the configuration
file. Note that if the output is dvi then the dimension parameters are not set to the configuration values
and not used at all. However some pdfTEX integer parameters can affect the pdf as well as dvi output
(currently
and
).
7.1
ñ
Document setup
(integer)
This parameter specifies whether the output format should be dvi or pdf. A positive value means pdf
output, otherwise one gets dvi output. This parameter cannot be specified after shipping out the first
page. In other words, this parameter must be set before pdfTEX ships out the first page if we want pdf
output. This is the only one parameter that must be set to produce pdf output. All others are optional.
This parameter cannot be set after the first page is shipped out.
When pdfTEX starts complaining about specials, one can be sure that the macro package is not aware of
this mode. A simple way of making macros pdfTEX aware is:
However, there are better ways to handle these things.
ñ
(integer)
This integer parameter specifies the level of text compression via
. Zero means no compression,
1 means fastest, 9 means best, 2..8 means something in between. A value out of this range will be
adjusted to the nearest meaningful value. This parameter is read each time pdfTEX starts a stream.
ñ
(integer)
This parameter specifies the accuracy of real numbers as written to the in pdf file. It gives the maximal
number of decimal digits after the decimal point of real numbers. Valid values are in range 0..5. A
18
The pdfTEX user manual
higher value means a more precise output, but also results in a much larger file size and more time to
display or print. In most cases the optimal value is 2. This parameter does not influence the precision
of numbers used in raw pdf code, like that used in
and annotation action specifications.
This parameter is read when pdfTEX writes a real number to the pdf output.
When including huge METAPOST images using
by saying:
.
ñ
, one can limit the accuracy to two digits
(integer)
This parameter specifies whether pdfTEX should try to move characters in range 0..31 to higher slots.
When set to 1, this feature affects only to fonts that have all character codes below 128, which applies to
for instance the Computer Moderd Roman fonts. When set to 2 or higher pdfTEX will try to move those
characters to free slots in encoding array, even in case the font contains characters with code greater
than or equal to 128. This parameter is read when pdfTEX writes a character of a font to the pdf output
at which moment it has to decide whether to move the character or not.
ñ
(integer)
This integer parameter specifies the default resolution of embedded pk fonts and is read when pdfTEX
downloads a pk font during finishing the pdf output. Currently bitmap fonts are displayed poorly, so
use Type 1 fonts when available!
ñ
(dimension)
This dimension parameter specifies the page width of the pdf output, being the screen, the paper or
whatrever the page content is put on. pdfTEX reads this parameter when it starts shipping out a page.
When at this moment the value is still 0, the page width is calculated as wbox being shipped out + 2 × (horigin +
).
Like the next one, this value replaces the value set in the configuration file. When part of the page falls
of the paper or screen, you can be rather sure that this parameter is set wrong.
ñ
(dimension)
Similar to the previous one, this dimension parameter specifying the page height of the pdf output. If
not given then the page height will be calculated as mentioned above.
ñ
(dimension)
This parameter can be used to set the horizontal offset the output box from the top left corner of the
page. A value of 1 inch corresponds to the normal TEX offset. This parameter is read when pdfTEX starts
shippin gout a page to the pdf outout.
ñ
(dimension)
This parameter is the vertical alternative of
. Keep in mind that the TEX coordinate system
starts in the top left corner, while the pdf one starts at the bottom.
ñ
(tokens)
pdfTEX expands this token list when it finishes the pdf output and adds the resulting character stream
to the root
object. When sound, these are applied to all pages in the document. Some examples of
19
The pdfTEX user manual
attributes are
, the rectangle specifying the natural size of the page,
, the rectangle
specifying the region of the page being displayed and printed, and
, the number of degrees (in
multiples of 90) the page should be rotated clockwise when it is displayed or printed.
ñ
(tokens)
This is similar to
, but it takes priority to the former one. It can be used to overwrite any
attribute given by
for individual pages. The token list is expanded when pdfTEX ships
out a page. The contents are added to the attributes of the current page.
7.2
ñ
The document info and catalog
hgeneral texti
This primitive allows the user to add information to the document info section; if this information
is provided, it can be extracted by Acrobat Reader (version 3.1: menu option Document Information,
General). The hgeneral texti is a collection of key--value--pairs. The key names are preceded by a ,
and the values, being strings, are given between parentheses. All keys are optional. Possible keys are
,
(defaults to current date),
,
(defaults to
),
(defaults to
),
,
, and
.
is the month,
and
are expressed in the form
is the day, hh is the hour,
is the minutes, and
, where
is the seconds.
is the year,
Multiple appearances of
will be concatenated to only one. If a key is given more than once,
then the first appearance will take priority. An example of the use of
is:
ñ
hgeneral texti [
haction speci ]
Similar to the document info section is the document catalog, where keys are
, which provides the
base url of the document, and
determines how Acrobat displays the document on startup.
The possibilities for the latter are explained in Table 3:
20
The pdfTEX user manual
value
meaning
neither outline nor thumbnails visible
outline visible
thumbnails visible
full--screen mode
Table 3 Supported
values.
In full--screen mode, there is no menu bar, window controls, nor any other window present. The default
setting is
.
The hopenactioni is the action provided when opening the document and is specified in the same way as
internal links, see section 7.7. Instead of using this method, one can also write the open action directly
into the catalog.
ñ
hgeneral texti
This primitive inserts the text to
array. The text must be conform to the specifications as laid
down in the pdf Reference Manual, otherwise the document can be invalid.
7.3
ñ
Fonts
[ hfont speci ] [
hintegeri ] [
hintegeri ] [
hintegeri ]
Although still in an experimental stage, and therefore subjected to changes, the next extension to the
TEX primitive
is worth mentioning.
The
means as much as: “hey TEX, when things are going to bad, you
may stretch the glyphs in this font as much as 3% or shrink them by 2%”. Because pdfTEX uses internal
datastructures with fixed widths, each additional width also means an additional font. For practical
reasons pdfTEX uses discrete steps, in this example a 1% one. This means that for font
upto 6
differently scaled alternatives are used. When no step is specified, 0.5% steps are used.
Roughly spoken, the trick is as follows. Consider a text typeset in triple column mode. When TEX cannot
break a line in the appropriate way, the unbreakable parts of the word will stick into the margin. When
pdfTEX notes this, it will try to scale (shrink) the glyphs in that line using fixed steps, until the line fits.
When lines are too spacy, the opposite happens: pdfTEX starts scaling (stretching) the glyphs until the
white space gaps is acceptable.
The additional fonts are named as
or
, and tfm files with these names and
appropriate dimensions must be available. So, each scaled font must have its own tfm file! When no
tfm file can be found, pdfTEX will try to generate it by executing the script
, where available
and supported.
This mechanism is inspired on an optimization first introduced by Herman Zapf, which in itself goes
back to optimizations used in the early days of typesetting: use different glyphs to optimize the greyness
21
The pdfTEX user manual
of a page. So, there are many, slightly different a’s, e’s, etc. For practical reasons pdfTEX does not use
such huge glyph collections; it uses horizontal scaling instead. This is sub--optimal, and for many fonts,
sort of offending to the design. But, when using pdf, it’s not that illogical at all: pdf viewers use so called
Multiple Master fonts when no fonts are embedded and/or can be found on the target system. Such fonts
are designed to adapt their design to the different scaling parameters. It is up to the user to determine
to what extend mixing slightly remastered fonts can be used without violating the design. Think of
an O: when simply stretched, the vertical part of the glyph becomes thicker, and looks incompatible to
an unscaled original. In a multiple master, one can decide to stretch but keep this thickness compatible.
ñ
(integer)
The output that pdfTEX produces is pretty compatible with the normal TEX output: TEX’s typesetting
engine is normally unchanged, because the optimization described here is turned off by default. At this
moment there are two methods provided. When
is set to 1, stretching is applied
after TEX’s normal paragraph breaking routines have broken the paragraph into lines. In this case, line
breaks are identical to standard TEX behaviour.
When set to 2, the width changes that are the result of stretching and shrinking are taken into account
while the paragraph is broken into lines. In this case, line breaks are likely to be different from those of
standard TEX. In fact, paragraphs may even become longer or shorter.
Both alternatives use the extended collection of tfm files that are related to the
settings as described in the previous section.
ñ
and
(integer)
We didn’t yet tell the whole story. One can imagine that some glyphs are more sensitive to scaling than
others. The
primitive can be used to influence the stretchability of a glyph. The syntax is
similar to
, and defaults to 1000, meaning 100%.
In this example an A may stretch 2.5 times as much as normal and the O is not to be stretched at all.
The minimum and maximum stretch is however bound by the font specification, otherwise one would
end up with more fonts inclusions than comfortable.
ñ
hfonti (expandable)
In pdf files produced by pdfTEX, one can recognize a font switch by the prefix followed by a number,
for instance
or
. This command returns the number pdfTEX uses to name a font resource,
e.g. for a font named as
this command returns number 12.
ñ
hfonti (read--only integer)
This command is similar to
Use of
and
document.
, but returns the object number instead of the name of a font.
allows user full access to all the font resources used in the
22
The pdfTEX user manual
ñ
hfonti hgeneral texti
This command causes pdfTEX to treat the characters in hgeneral texti as if they were used with hfonti ,
which means that the corresponding glyphs will be embedded into the font resources in the pdf output.
Nothing is appended to the list being built.
7.4
XObject forms
The next three primitives support a pdf feature called ‘object reuse’ in pdfTEX. The idea is first to create
a XObject form in pdf. The content of this object corresponds to the content of a TEX box, which can
also contain pictures and references to other XObject form objects as well. After that the XObject form
can be used by simply referring to its object number. This feature can be useful for large documents
with a lot of similar elements, as it can reduce the duplication of identical objects.
These command behave similar
,
code, they take care of text typeset by TEX.
ñ
and
but instead of taking raw pdf
[ hattr speci ] [ hresources speci ] hbox numberi
This command creates a XObject form corresponding to the contents of the box hbox numberi . The
box can contain other raw objects, XObject forms or images as well. It can however not contain annotations because they are laid out on a separate layer, are positioned absolutely, and have a dedicated
housekeeping.
When hattr speci is given, the text will be written as additional attributes of the form.
The hresources speci is similar, but the text will be added to the resources dictionary of the form.
The text given by hattr speci or hresources speci is written before other keys of the form dictionary
and/or the resources dictionary and takes priority to the further ones.
ñ
hintegeri
The form is kept in memory and will be written to the pdf output only when its number is refered to by
or
is preceded by
. Nothing is appended to the list being built.
The number of the most recently created XObject form is accessible via
.
When issued,
appends a whatsit node to the list being built. When the whatsit node is
searched at shipping time, pdfTEX will write the form with number hintegeri to the pdf output if it is not
written yet.
ñ
(read--only integer)
The number of the most recently created XObject form is accessible via
.
As said, this feature can be used for reusing information. This mechanism also plays a role in typesetting
fill--in form. Such widgets sometimes depends on visuals that show up on user request, but are hidden
otherwise.
23
The pdfTEX user manual
7.5
Graphics inclusion
pdf provides a mechanism for embedding graphic and textual objects: XObject forms. In pdfTEX this
mechanism is accessed by means of
,
and
. A special kind of
XObjects are bitmap graphics and for manipulating them similar commands are provided.
ñ
[ hrule speci ] [ hattr speci ] [ hpage speci ] hfile speci
This command creates an image object. The dimensions of the image can be controlled via hrule speci .
The default values are zero for depth and ‘running’ for height and width. If all of them are given, the
image will be scaled to fit the specified values. If some of them (but not all) are given, the rest will
be set to a value corresponding to the remaining ones so as to make the image size to yield the same
proportion of width : (height + depth) as the original image size, where depth is treated as zero. If
none of them is given then the image will take its natural size.
An image inserted at its natural size often has a resolution of
(see below) given
in dots per inch in the output file, but some images may contain data specifying the image resolution,
and in such a case the image will be scaled to the correct resolution. The dimension of the image can be
accessed by enclosing the
command to a box and checking the dimensions of the box:
Now we can use
and
to question the natural size of the image as determined by pdfTEX. When
dimensions are specified before the
, the graphic is scaled to fit these. Opposite to for
instance the
primitive, the filename is supplied between braces.
The image type is specified by the extension of the given file name, so
for tiff, and
for pdf file. Otherwise the image is treated as pdf (
stands for png image,
).
Similarly to
, the optional text given by hattr speci will be written as additional attributes of
the image before other keys of the image dictionary.
ñ
hintegeri
The image is kept in memory and will be written to the pdf output only when its number is refered to
by
or
is preceded by
. Nothing is appended to the list being
built.
appends a whatsit node to the list being built. When the whatsit node is searched at
shipping time, pdfTEX will write the image with number hintegeri to the pdf output if it has not been
written yet.
ñ
(read--only integer)
The number of the most recently created XObject image is accessible via
ñ
.
(integer)
This parameter specifies the default resolution of included bitmap images (png, tiff, and jpeg). This
parameter is read when pdfTEX creates an image via
. When not given or set to 0 pdfTEX
treates it as 72.
24
The pdfTEX user manual
7.6
Annotations
pdf level 1.2 provides four basic kinds of annotations:
•
•
•
•
hyperlinks, general navigation
text clips (notes)
movies
sound fragments
The first type differs from the other three in that there is a designated area involved on which one can
click, or when moved over some action occurs. pdfTEX is able to calculate this area, as we will see later.
All annotations can be supported using the next two general annotation primitives.
ñ
[ hrule speci ] hgeneral texti
This command appends a whatsit node corresponding to an annotation to the the list being built.
The dimensions of the annotation can be controlled via Something rule spec. The default values are
running for all width, height and depth. When an annotation is written out, running dimensions will
take the corresponding values from the box containing the whatsit node representing the annotation.
The hgeneral texti is inserted as raw pdf code to the contents of annotation. The annotation is written
out only if the corresponding whatsit node is searched at the shipping time.
ñ
(read--only integer)
This primitive returns the object number of the last annotation created by
itives allow users to create any annotation that cannot be created by
7.7
. These two prim(see below).
Destinations and links
The first type of annotation mentioned before, is implemented by three primitives. The first one is used
to define a specific location as being referred to. This location is tied to the page, not the exact location
on the page. The main reason for this is that pdf maintains a dedicated list of these annotations —and
some more when optimized— for the sole purpose of speed.
ñ
hdest speci
This primitive appends a whatsit node which establishes a destination for links and bookmark outlines;
the link is identified by either a number or a symbolic name, and the way the viewer is to display the
page must be specified in hdest typei , which must be one of those mentioned in table 4.
The specification
can optionally be followed by
hintegeri to provide a fixed zoom--in. The
Something integer is like TEX magnification, i.e. 1000 is the ‘normal’ page view. When
hintegeri is
given the zoom factor changes to number, otherwise the current zoom factor is kept unchange.d
The destination is written out only the corresponding whatsit node is searched at the shipping time.
ñ
[ hrule speci ] [ hattr speci ] haction speci
This primitive is used along with
and appends a whatsit node corresponding to the start
of a hyperlink. The whatsit node representing the end of the hyperlink is created by
.
25
The pdfTEX user manual
keyword
meaning
fit the page in the window
fit the width of the page
fit the height of the page
fit the ‘Bounding Box’ of the page
fit the width of ‘Bounding Box’ of the page
fit the height of ‘Bounding Box’ of the page
goto the current position (see below)
Table 4 The outline and destination appearances.
The dimensions of the link are handled in the similar way as in
. Both
and
must be in the same level of box nesting. A hyperlink with running width can be multi-line or even multi--page, in which case all horizontal boxes with the same nesting level as the boxes
containing
and
will be treated as part of the hyperlink. The hyperlink is
written out only if the corresponding whatsit node is searched at the shipping time.
Additional attributes, which are explained in great detail in the pdf Reference Manual, can be given
via hattr speci . Typically, the attributes specify the color and thickness of any border around the link.
Thus
specifies a color (in rgb) of dark red, and a border thickness of
2 points.
While all graphics and text in a pdf document have relative positions, annotations have internally hard-coded absolute positions. Again we’re dealing with a speed optimization. The main disadvantage is that
these annotations do not obey transformations issued by
’s.
The haction speci specifies the action that should be perfomed when the hyperlink is activated while
the huser-action speci performs a user--defined action. A typical use of the latter is to specify a url, like
, or a named action like
.
A hgoto-action speci performs a GoTo action. Here hnumidi and hnameidi specify the destination identifier (see below). The hpage speci specifies the page number of the destination, in this case the
zoom factor is given by hgeneral texti . A destination can be performed in another pdf file by specifying hfile speci , in which case hnewwindow speci specifies whether the file should be opened in a
new window. A hfile speci can be either a
or a
. The default behaviour of
the hnewwindow speci depends on the browser setting.
A hthread-action speci performs an article thread reading. The thread identifier is similar to the destination identifier. A thread can be performed in another pdf file by specifying a hfile speci .
ñ
This primitive ends a link started with
. All text between
and
will be treated as part of this link. pdfTEX may break the result across lines (or pages), in
which case it will make several links with the same content.
26
The pdfTEX user manual
ñ
(dimension)
This dimension parameter specifies the margin of the box representing a hyperlink and is read when a
page containing hyperlinks is shipped out.
7.8
ñ
Bookmarks
haction speci [
hintegeri ] hgeneral texti
This primitive creates an outline (or bookmark) entry. The first parameter specifies the action to be
taken, and is the same as that allowed for
. The hcounti specifies the number of direct
subentries under this entry; specify 0 or omit it if this entry has no subentries. If the number is negative,
then all subentries will be closed and the absolute value of this number specifies the number of subentries. The htexti is what will be shown in the outline window. Note that this is limited to characters in
the pdf Document Encoding vector. The outline is written to the pdf output immediately.
7.9
ñ
Article threads
hrule speci [ hattr speci ] hid speci
Defined an article thread. Treads with same identifiers (spread across the document) will be joined
together.
ñ
(dimension)
Specifies a margin to be added to the thread dimensions.
7.10
ñ
Miscellaneous
[
] hgeneral texti
Like
in normal TEX, this command inserts raw pdf code into the output. This allows support
of color and text transformation. This primitive is heavily used in the METAPOST inclusion macros.
Normally pdfTEX ends a text section in the pdf output and resets the transformation matrix before
inserting hgeneral texti , however it can be turned off by giving the optional keyword
. This
command appends a whatsit node to the list being built. hgeneral texti is expanded when the whatsit
node is created and not when it is shipped out, so this primitive behaves like
.
ñ
[ hobject type speci ] hgeneral texti
This command creates a raw pdf object that ends op in the pdf file as
...
When hobject type speci is not given, a dictionary object with contents hgeneral texti is created.
.
When however hobject type speci is given as hattr speci
, the object will be created as a stream
with contents hgeneral texti and additional attributes in hattr speci .
When hobject type speci is given as hattr speci
, then the hgeneral texti will be treated as a file
name and its contents will be copied into the stream contents.
27
The pdfTEX user manual
The object is kept in memory and will be written to the pdf output only when its number is refered to by
or when
is preceded by
. Nothing is appended to the list being built.
The number of the most recently created object is accessible via
.
ñ
(read--only integer)
This command returns the object number of the last object created by
ñ
.
hintegeri
This command appends a whatsit node to the list being built. When the whatsit node is searched at
shipping time, pdfTEX will write the object with number hintegeri to the pdf output if it has not been
written yet.
ñ
Returns the version of pdfTEX multiplied by 100, e.g. for version
typeset with version 14.e.
it returns 13. This document is
ñ
Returns the revision of pdfTEX, e.g. for version
it returns .
8 Graphics and color
pdfTEX supports inclusion of pictures in png, jpeg, tiff and pdf format. The most common technique
—the inclusion of eps figures— is replaced by pdf inclusion. eps files can be converted to pdf by
GhostScript, Acrobat Distiller or other PostScript--to--pdf convertors. The BoundingBox of a pdf file
is taken from CropBox if available, otherwise from the MediaBox. To get the right BoundingBox from a
eps file, before converting to pdf, it is necessary to transform the eps file so that the start point is at
the (0,0) coordinate and the page size is set exactly corresponding to the BoundingBox. A Perl script
(epstopdf) for this purpose has been written by Sebastian Rahtz. The TEXutil utility script that comes
with ConTEXt can so a similar job. (Concerning this conversion, it handles complete directories, removes
some garbage from files, takes precautions against duplicate conversion, etc.)
Other alternatives for graphics in pdfTEX are:
LATEX picture mode Since this is implemented simply in terms of font characters, it works in exactly
the same way as usual.
Xy--pic If the PostScript back--end is not requested, Xy-pic uses its own Type 1 fonts, and needs no
special attention.
tpic The ‘tpic’
commands (used in some macro packages) can be redefined to produce literal
pdf, using some macros written by Hans Hagen.
METAPOST Although the output of METAPOST is PostScript, it is in a highly simplified form, and a
METAPOST to pdf conversion (written by Hans Hagen and Tanmoy Bhattacharya) is implemented as a
set of macros which reads METAPOST output and supports all of its features.
28
The pdfTEX user manual
pdf It is possible to insert arbitrary one--page--only pdf files, with their own fonts and graphics, into a
document. The front page of this document is an example of such an insert, it is an one page document
generated by pdfTEX.
For new work, the METAPOST route is highly recommended. For the future, Adobe has announced
that they will define a specification for ‘encapsulated pdf’, and this should solve some of the present
difficulties.
The inclusion of raw PostScript commands —a technique utilized by for instance the
package— cannot be supported. Although pdf is a direct descendant of PostScript, it lacks any programming
language commands, and cannot deal with arbitrary PostScript.
Abbreviations
In this document we used a few abbreviations. For convenience we mention their meaning here.
afm
ascii
CMacTEX
ConTEXt
djgpp
dvi
eps
epstopdf
e-TEX
fpTEX
gnu
jpeg
LATEX
METAFONT
METAPOST
MikTeX
MSDos
pdf
pdfe-TEX
Adobe Font Metrics
American Standard Code for Information Interchange
MacIntosh Web2c distribution
general purpose macro package
DJ Delorie’s gnu Programming Platform
natural TEX Device Independ fileformat
Encapsulated PostScript
eps to pdf conversion tool
an extension to TEX
Win32 Web2c distribution
GNU’s Not Unix
Joined Photographic Expert Group
general purpose macro package
graphic programming environment, bitmap output
graphic programming environment, vector output
Win32 distribution
Microsoft DOS platform (Intel)
Portable Document Format
e-TEX extension producing
29