[OS X TeX] XeTeX... infos before I switch ?

Bruno Voisin bvoisin at mac.com
Wed Jul 28 12:20:46 CEST 2004


Le 28 juil. 04, à 11:09, Gilles Serasset a écrit :

> I'm hearing a lot about XeTeX on the list these days and trying it is  
> rather high on my to do list.
>
> [...]
>
> Does this means that it will not work with Bibdesk managed  
> bibliographies (as bibdesk uses the TeX encoding for accents) ?
>
> If yes, is there a way to manage a bibliography file, say, in unicode,  
> and then use it in a latin1 encoded document ?

I think there is a way and it has been discussed on the XeTeX mailing  
list <http://tug.org/mailman/listinfo/xetex>, whose archives are at  
<http://tug.org/pipermail/xetex/>. However, not being a BibTeX users  
myself (I still do all my bibliographies by hand), I must admit I do  
not pay much attention to BibTeX-related posts and cannot say for sure.

> May I use XeTeX to typeset documents that are "LaTeX only" (i.e. that  
> I co-author with PC users) ?

I think that, as soon as you use XeTeX-specific commands or  
functionalities related to fonts, your .tex document will no longer be  
portable, i.e. Windows or Linux users won't be able to process it.

One point that may be relevant if you switch, and which hadn't been  
evoked in my earlier post re. Hoefler Text, is that, in its present,  
pre-release, state, XeTeX may induce difficulties for maths.  
Specifically, maths accents in (La)TeX are taken by default from the  
main text font (i.e. that corresponding to \rm in plain TeX and \textrm  
or \rmfamily in LaTeX). This archaic design, from the early days of TeX  
when 7-bit fonts ruled, creates problems when you redefine this text  
font to be a Unicode font, for example for Hoefler Text in my original  
example:

	\DeclareFontFamily{U}{hoefler}{}
	\DeclareFontShape{U}{hoefler}{m}{n}%
	      {<-> "Hoefler\space Text"}{}
	\DeclareFontShape{U}{hoefler}{m}{it}%
	      {<-> "Hoefler\space Text\space Italic"}{}
	\DeclareFontShape{U}{hoefler}{bx}{n}%
	      {<-> "Hoefler\space Text\space Black"}{}
	\DeclareFontShape{U}{hoefler}{b}{n}%
	      {<-> ssub * hoefler/bx/n}{}
	\DeclareFontShape{U}{hoefler}{bx}{it}%
	      {<-> "Hoefler\space Text\space Black\space Italic"}{}
	\DeclareFontShape{U}{hoefler}{b}{it}%
	      {<-> ssub * hoefler/bx/it}{}
	\DeclareFontShape{U}{hoefler}{m}{sc}%
	      {<-> "Hoefler\space Text:Letter\space Case=Small\space Caps"}{}
	\renewcommand{\encodingdefault}{U}
	\renewcommand{\rmdefault}{hoefler}

There are two fixes to this:

- Define a new font family specifically for taking the math accents  
from. For example, in a plain TeX document of mine, using Trebuchet MS  
for text and Lucida Bright/New Math otherwise, I ended up writing:

	\font\tenmac=lbr at 9.5pt   \skewchar\tenmac=127
	\font\sevenmac=lbr at 6.9pt \skewchar\sevenmac=127
	\font\fivemac=lbr at 5.2pt  \skewchar\fivemac=127

	\def\hexnumber#1{\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or
	  9\or A\or B\or C\or D\or E\or F\fi}
	\newfam\macfam
	\edef\themacfam{\hexnumber\macfam}

	\def\hat{\mathaccent"7\themacfam AA }
	\def\tilde{\mathaccent"7\themacfam AB }

There are probably better ways to do this; moreover, some ways to  
achieve the same in LaTeX should be looked for, which I didn't attempt  
due to lack of time. Any volunteer?

- Do not redefine the main text font to be a Unicode font; i.e., in the  
above Hoefler Text example, suppress the two lines:

	\renewcommand{\encodingdefault}{U}
	\renewcommand{\rmdefault}{hoefler}

Instead, define a specific control sequence to trigger the use of the  
Unicode font, like:

	 
\DeclareRobustCommand{\hoefler}{\fontencoding{U}\fontfamily{hoefler}\sel 
ectfont}

Here's a small LaTeX test I just wrote and tried:


\documentclass[a4paper,12pt]{article}

\DeclareFontFamily{U}{hoefler}{}
\DeclareFontShape{U}{hoefler}{m}{n}%
       {<-> "Hoefler\space Text"}{}
\DeclareFontShape{U}{hoefler}{m}{it}%
       {<-> "Hoefler\space Text\space Italic"}{}
\DeclareFontShape{U}{hoefler}{bx}{n}%
       {<-> "Hoefler\space Text\space Black"}{}
\DeclareFontShape{U}{hoefler}{b}{n}%
       {<-> ssub * hoefler/bx/n}{}
\DeclareFontShape{U}{hoefler}{bx}{it}%
       {<-> "Hoefler\space Text\space Black\space Italic"}{}
\DeclareFontShape{U}{hoefler}{b}{it}%
       {<-> ssub * hoefler/bx/it}{}
\DeclareFontShape{U}{hoefler}{m}{sc}%
       {<-> "Hoefler\space Text:Letter\space Case=Small\space Caps"}{}

\DeclareRobustCommand{\hoefler}{\fontencoding{U}\fontfamily{hoefler}\sel 
ectfont}
\DeclareTextFontCommand{\hoefrm}{\hoefler}
\DeclareTextFontCommand{\hoefbf}{\hoefler\bfseries}
\DeclareTextFontCommand{\hoefit}{\hoefler\itshape}
\DeclareTextFontCommand{\hoefbi}{\hoefler\bfseries\itshape}
\DeclareTextFontCommand{\hoefsc}{\hoefler\scshape}

\begin{document}

blah \hoefrm{et re-blah} \hoefbf{et encore blah} \hoefit{et toujours  
blah} \hoefsc{et puis blah-blah}

blah {\hoefler et re-blah \textbf{et encore blah} \textit{et toujours  
blah} \textsc{et puis blah-blah}}

blah {\hoefler et re-blah {\bfseries et encore blah} {\itshape et  
toujours blah} {\scshape et puis blah-blah}}

\end{document}


Hope this helps,

Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list