[XeTeX] Unicode Arabic inside English with XeTeX

Ross Moore ross at ics.mq.edu.au
Sun Mar 11 08:57:34 CET 2007


Hi Will, Manuel and others,

On 11/03/2007, at 7:18 AM, Will Robertson wrote:

> Hi Manuel,
>
> No trouble asking here if you get stuck, that's why we're here!
>
> On 11/03/2007, at 11:09 , Manuel Souto Pico wrote:
>
>> \newcommand{\ar}[1]{\font\ar="Scheherazade-AAT" at 12 pt {\ar#1}
>> \normalfont}

Please do *not* use such short macro names.
There is too likely a chance that it clashes with a macro
defined in standard LaTeX packages, or within TeX itself.
(In this case, \ar is used by Xy-pic for arrows in diagrams.)

Even if you don't use those other packages, some of your work
may end up within a volume alongside other people's work
where dthey are used.
This can creates a significant head-ache for editors of such
volumes of conglomerate material.

It is good practice to use descriptive macro-names, rather
than cryptic abbreviations, so that it is clear just what
kind of material is being presented...

>
> As Herb said, this won't work (more than once) because the \font\ar=
> redefines the command \ar you've set up. Since you're using LaTeX,
> it's also probably better to be using the fontspec interface rather
> than the plain TeX one. Note that \normalfont isn't required above
> (nor \selectfont).
>
> Following your example, this would be better:
>
> \font\arabicfont="Scheherazade-AAT" at 12pt
> \newcommand\arabic[1]{{\arabicfont#1}}

  ... this is a much better use of descriptive macro-names.

>
> Better still would be:
>
> \newfontfamily\arabicfont{Scheherazade-AAT}
> \newcommand\arabic[1]{{\arabicfont#1}}
>
> The reason this is better is that the font size isn't hard coded in
> the \arabic macro. (See the fontspec manual for explanation of
> \newfontfamily, etc.) You don't want to have to use a different macro
> if you want Arabic text in a section heading, for example!
>
> Hope this helps,
> Will


Cheers,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------




More information about the XeTeX mailing list