[XeTeX] xetex and accents

Ross Moore ross at ics.mq.edu.au
Tue Jan 8 00:17:29 CET 2008


Hello Radhakrishna,

On 08/01/2008, at 5:50 AM, Radhakrishna Valiveti wrote:

> Hi,
>
>    I am currently using xetex + fontspec (which are part of MikTeX  
> v.7 for Windows). I am able to get xetex to use the fonts on my  
> windows system. I want to control the placement of the accents  
> generated with Tex commands such as \.{}, \={}, \d{}. Previously I  
> was able to do this using the macros provided in exaccent.sty. I am  
> wondering how I would accomplish the same result when xetex is  
> directly using a native TTF font.
>
>   I have pasted a small test file at the end of this email. Any  
> help/pointers are appreciated.

The *normal* way would be to simply load
   \usepackage{xunicode}
and forget about  exaccent  altogether.

This has lines:

\DeclareEncodedCompositeCharacter{\UTFencname}{\=}{0304}{02C9}  %  
Combining macron
\DeclareEncodedCompositeCharacter{\UTFencname}{\.}{0307}{02D9}  %  
Combining dot above
\DeclareEncodedCompositeCharacter{\UTFencname}{\d}{0323}{0323}  %  
Combining dot below

which define the action of \=  \.  and \d
to use the "Combining characters" to be found at code-points:
  Ux0304  Ux0307  Ux0323  respectively, whenever a preformed
codepoint is not directly available.

However, this does not work with  Trebuchet MS  as it does not
have the requisite combining characters at these code-points.
Indeed, from your \upperaccent  and  \loweraccent  commands,
it seems to rely on non-combining glyphs at  Ux0009 and Ux000A
to construct the accented characters, but these seen not to be
accessible to XeTeX .
(On the other hand, the appropriate characters are accessible
at  Ux02C9  and  Ux02D9 .)


Personally, I'd advise against using Trebuchet MS and choose
another font that has the correct combining characters.

Nevertheless, something can be done using Trebuchet,
with a document preamble as follows:


\documentclass[11pt,letterpaper]{article}
\usepackage{fontspec}
\usepackage{exunicode}
\usepackage{exaccent}
\newfontfamily\trebuchetfont[BoldFont = {* Bold},
   ItalicFont = {* Italic}, BoldItalicFont = {* Bold Italic}] 
{Trebuchet MS}
\setmainfont{Arial}

\DeclareTextCommand{\=}{\UTFencname}[1]{\upperaccent[0ex]{"02C9}{#1}}
\DeclareTextCommand{\.}{\UTFencname}[1]{\upperaccent[0ex]{"02D9}{#1}}
\DeclareTextCommand{\d}{\UTFencname}[1]{\loweraccent[0ex]{"02D9}{#1}}

\begin{document}
... etc.



Adjust the [0ex] to something else if the placement of accents
is not to your liking.


The only problem with this is that you will always use \upperaccent
or \loweraccent to place the accent, even when the font contains
a pre-formed accented character;  e.g. for  \.{Z}  and  \.{z} .
      (These 2 are the only relevant ones with  Trebuchet MS .)


In fact, using  xunicode.sty  there is a way to have \upperaccent
and \loweraccent  do the work only when there is no preformed character.
Since it's rather complicated, I'll not explain it here.



Hope this helps,

	Ross

>
>
> thanks,
> radha
>
>
> \documentclass[11pt,letterpaper]{article}
> \usepackage{fontspec}
> \usepackage{exaccent}
> \newfontfamily\trebuchetfont[BoldFont = {* Bold}, ItalicFont = {*  
> Italic}, BoldItalicFont = {* Bold Italic}]{Trebuchet MS}
> \setmainfont{Arial}
> %======================================
> % Adjustment to the location of accents
> % code 6 (small circle); 9(bar); 10(dot)
> %=======================================
> \DeclareTextCommand{\=}{T1}[1]{\upperaccent[1ex]{9}{#1}}   %  
> upperaccent is defined in exaccent.sty
> \DeclareTextCommand{\.}{T1}[1]{\upperaccent[1ex]{10}{#1}}  % The  
> "1ex" is the relative position of the accent.
> \DeclareTextCommand{\d}{T1}[1]{\loweraccent[1ex]{10}{#1}}
>
> \begin{document}
> {\trebuchetfont The quick brown fox jumped over a lazy dog. \={T}he  
> \d{q}uick \={b}rown \.fox jumped over a lazy dog.}\par
> {\bf\trebuchetfont The quick brown fox jumped over a lazy dog. \={T} 
> he \d{q}uick \={b}rown \.fox jumped over a lazy dog.}\par
> {\it\trebuchetfont The quick brown fox jumped over a lazy dog. \={T} 
> he \d{q}uick \={b}rown \.fox jumped over a lazy dog.}\par
>
> \fontsize{18}{21}{\trebuchetfont The quick brown fox jumped over a  
> lazy dog. \={T}he \d{q}uick \={b}rown \.fox jumped over a lazy dog.} 
> \par
> \fontsize{18}{21}{\bf\trebuchetfont The quick brown fox jumped over  
> a lazy dog. \={T}he \d{q}uick \={b}rown \.fox jumped over a lazy  
> dog.}\par
>
> \end{document}
>
>
> Radhakrishna Valiveti
> rvaliveti at yahoo.com
>
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex

------------------------------------------------------------------------
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