# [pdftex] pdfTeX, Edmac and margin kerning

Oliver Heins olli at sopos.org
Thu Nov 14 14:28:47 CET 2002

I posted the following text to the german TeX-Newsgroup some days ago,
but didn't get an answer (yet).  So I decided to translate it and repost

I would like to typeset the text of a critical edition with optical
margin adjustment.  The edition is tyepesetted with edmac
TeX.  Edmac und optical margin adjustment don't seem to cooperate with
each other, as it can be seen in the following minimalexample.  My
question is, how Han The Than's pdfTeX-hack is implemented, I read his
thesis (or at least the according chapters), but still don't know where
it's done: At the level of TeX's primitives (as I guess), or on the
level of macros?  If it's implemented based on the primitives, why
doesn't it work with edmac?

I post a minimal example and try to show how the edmac's macros \pstart
and \pend, which obviously prevent character protruding, work and how
they change plain TeX's behaviour.

------- Schnipp --------
% minimal example: edmac with (i.e. without) optical margin adjustment

\hsize=3.2in

\input edmac.doc

\input protcode
\setprotcode\font
\pdfprotrudechars=1

\beginnumbering

\pstart

EDMAC is a program written as a set of plain TeX macros for formatting
complex critical editions. You mark up your text and notes using the
tags provided by EDMAC, and then TeX will create a beautiful book for
you with the text line numbered, lemmata referred to by line-number, up
to six layers of notes at the bottom of the page (variants, testimonia,
etc.), as well as up to six sets of notes sent to appendices. It is also
possible to control the layout of each layer of notes separately: single
column, two- or three-column, paragraphed, etc.

\pend

EDMAC is a program written as a set of plain TeX macros for formatting
complex critical editions. You mark up your text and notes using the
tags provided by EDMAC, and then TeX will create a beautiful book for
you with the text line numbered, lemmata referred to by line-number, up
to six layers of notes at the bottom of the page (variants, testimonia,
etc.), as well as up to six sets of notes sent to appendices. It is also
possible to control the layout of each layer of notes separately: single
column, two- or three-column, paragraphed, etc.

\endnumbering

\bye

------- Schnapp --------

edmac.doc:
http://www.ctan.org/tex-archive/macros/plain/contrib/edmac/edmac316.zip

protcode:
http://sunsite.utk.edu/ftp/usr-218-2/CTAN/obsolete/systems/pdftex/ext/
there beside protcode.tex abbr.tex, too

Above example compiled:
http://www.offizinverlag.de/edmactest.pdf

Beside the fact, that the lower section isn't really typeset the way it
should be, pdfTeX (tested: pdfTeX (Web2C 7.3.7)
3.14159-1.00a-pretest-20011114-ojmw from Debian Woody's teTeX and pdfTeX
(Web2C 7.3.9) 3.14159-1.10a-devel from experimental Debian packages of
the newest neuesten teTeX beta (AFAIK)) at least does margin kerning
there.  In the upper section, with activated edmac, it does nothing
(visible).

Edmac changes TeX's ouput-routine.  Everything within a \pstart
... \pend-environment ist put in a box.  The definition of \pstart says:
"\global\setbox\raw at text=\vbox\bgroup", what is ended in \pend (with
"\egroup").  The changed output routine now calls macro a named
\do at line, which fetches one line of text and writes it in a horizontal
box: "\global\setbox\one at line=\vsplit\raw at text to\baselineskip
\unvbox\one at line \global\setbox\one at line=\lastbox", then checks whether
a line number is to be set and does so, if possible: "\hbox to
\hsize{\affixline at num% this sets the linenumber
\hfil\hbox to \wd\one at line{\new at line\unhbox\one at line}}}".  The macro
\new at line only writes the current linenumber to an auxilary file.

The output-routine of edmac doesn't differs IMHO from plain TeX's, it
mainly does a \topins and a \footins.

Worth mentioning is, that level 2 margin kerining (\pdfprotrudechars=2)
changes the linebreaking, it is obviously computed by the new algorithm.
Nevertheless, the actual protruding -- the shifting of the margin
characters around the margin -- isn't done.

Rather helpless,
olli