# [XeTeX] xetex file organization

Bruno Voisin bvoisin at mac.com
Wed Nov 3 16:04:16 CET 2004

Hi Jonathan,

> I'm trying to reorganize the various files that are part of the XeTeX
> distribution in order to fit the TDS better, and I'd appreciate any
>
> Here's what I'm thinking of so far:

Some comments (taking into account I'm not a specialist on the TDS, so
if somebody says something different they're probably right):

> texmf.local/
> 	fonts/
> 		misc/
> 			xetex/
> 				fontmapping/
> 					(TECkit mapping file(s) for xetex font-mapping mechanism)

Looking at the mention in tds.dvi (p. 8) of fonts/lig/, and given (if I
understood correctly) the TECkit mapping files are used by XeTeX to
perform some kind of ligature, would it make sense to use
fonts/lig/xetex/teckit/ instead? But then maybe the lig files,
mentioned in tds.dvi, are specific to afm2pl and have a specific
syntax, implying that another directory should be used, maybe
fonts/tec/, or simply fonts/misc/ as you did. So in short I would
suggest replacing

fonts/misc/xetex/fontmapping/

by either of

fonts/lig/xetex/teckit/
fonts/misc/xetex/teckit/
fonts/tec/xetex/teckit/
fonts/map/xetex/teckit/

to parallel stuff like

fonts/map/dvips/updmap/

Wait: looking again at the present texmf.tetex tree, there's another
possibility which might be more appropriate:

xetex/teckit/

to parallel stuff like

omega/ocp/
omega/otp/

> 		opentype/
> 			xetex/
> 				bitstrea/
> 				bluesky/
> 				hoekwater/
> 				public/
> 					(...etc, as under current fonts/otf)

I would agree with Adam that, provided the OpenType format is something
standard and not specific to XeTeX, it would make more sense to use

fonts/opentype/bitstrea/
bluesky/
[...]

in accordance with the TDS recommendation of
fonts/<type>/<supplier>/<typeface>/.

All the rest looks fine to me, but again I'm not a specialist. That
said:

> 	tex/
> 		generic/
> 			hyphen/
> 				(Unicode-compatible versions of hyphenation files;
> 				these are designed to still work with standard TeX as well)

Hopefully at some point in the future, when/if the capability of
reading files in a specific encoding is added to XeTeX, this directory
would become unnecessary (as well as the modified version of url.sty in
texmf.gwtex).

> 		xelatex/
> 			[...]
> 			graphics/
> 				color.sty
> 				graphics.sty
> 				xetex.def

Hopefully, when xetex.def is added to the standard LaTeX graphics
package and color.sty and graphics.sty are modified accordingly, this
directory will become unnecessary.

On a related note, to provide a temporary fix for packages that assume
either dvips or pdfTeX is used, and until these packages become
XeTeX-aware, I would suggest adding modified config files, like
color.cfg and graphics.cfg, allowing automatic detection of XeTeX
(based on \XeTeXversion, for example) and selection of the [xetex]
option when appropriate, yielding:

> 			graphics/
color.cfg
> 				color.sty
graphics.cfg
> 				graphics.sty
> 				xetex.def
> 				xelatex.ini

A simple modification of graphics.cfg, for example, would include:

% Select an appropriate default driver
\begingroup
\chardef\x=0 %
% check pdfTeX
\@ifundefined{pdfoutput}{}{%
\ifcase\pdfoutput
\else
\chardef\x=1 %
\fi
}%
% check VTeX
\@ifundefined{OpMode}{}{%
\chardef\x=2 %
}%
% check XeTeX
\@ifundefined{XeTeXversion}{}{%
\chardef\x=3 %
}%
\expandafter\endgroup
\ifcase\x
% default case
\ExecuteOptions{dvips}%
\or
% pdfTeX is running in pdf mode
\ExecuteOptions{pdftex}%
\or
% VTeX is running
\ExecuteOptions{vtex}%
\else
% XeTeX is running
\ExecuteOptions{xetex}%
\fi

Similarly, given that hyperref.sty includes some code doing automatic
driver selection (by testing for \pdfoutput etc.), and that there is a
hyperref.cfg defining dvips as the default driver, would it make sense
to include a file

tex/
xelatex/
hyperref/
hyperref.cfg

identical to the standard hyperref.cfg ecept for the addition of a line

\expandafter\ifx\csname
XeTeXversion\endcsname\relax\def\Hy at driver{hdvipdfm}\fi

or similar (I'm not sure the above would work, it's untested, Ross
would probably know better than me).

> I've included a "xetex" level in several cases here (under fonts/misc,
> fonts/opentype, scripts) to make it easy to distinguish items
> installed with xetex from other files that might be present. Is this a
> reasonable thing to do?

See above.

> Even with this (or any other) file organization, I don't think the
> Web2C 2.5.3 default of
>
> 	TEXINPUTS = .;$TEXMF/tex/{$progname,generic,}//
>
> in texmf.cnf by itself can be adequate for xelatex, as it needs to
> find files within the main latex tree(s) as well as under the specific
> xelatex program name. So we'll still need to add entries in texmf.cnf.
> I'm thinking something like:
>
> 	TEXINPUTS.xetex = .;$TEXMF/tex/{xetex,generic,}// > TEXINPUTS.xelatex = .;$TEXMF/tex/{xelatex,latex,generic,}//

Looks fine to me.

FWIW,

Bruno Voisin