David Kastrup writes:
 >         Javier Bezos <[log in to unmask]> writes:
 >
 > > > %    This mapping needs to be set up only once so here it is done at
 > > > %    |\begin{document}|
 > >
 > > I think a better place is inputenc itself or fontenc;
 > > otherwise saveboxes in the preamble won't work.
 >
 > Saveboxes in the preamble are probably not a good idea, anyway, since
 > the font setup has not completed there.

well, yes. this is an open question to us for a long time.

I tend to think that one has to view the preamble as a "non-typesetting area"
otherwise you end up with all kind of complications, e.g., the font setup not
being ready, etc.

assuming the reading of the utf8 declaration files happens in inputenc only,
then any later encoding declaration will not be used. if it happens in fontenc
then this situation is better as it could always then loads the Xenc.def file
and the Xenc.dfu file at that point in time. One can then of course do the
following:

when inputenc is processed, read the .dfu files for all encodings known alread
(ie those on the cdp list) and set a flag to signal to fontenc to take over
from then on. that might actually be the best solution. i didn't implemented it
that way to avoid having to distribute fontenc as well right now.

however, i still think that there are problems with typesetting in the
preamble and while i doubt it should be completely banned it is best to assume
that normally it doesn't work or can't be relied on.

frank