[XeTeX] xunicode's textipa command

Ross Moore ross at ics.mq.edu.au
Sun Nov 8 19:55:47 CET 2009


Hello Andy,

On 08/11/2009, at 3:02 PM, Andy Lin wrote:

> Hi Ross,
>
> On Sat, Nov 7, 2009 at 00:14, Ross Moore <ross at ics.mq.edu.au> wrote:
>> Hello Andy,
>>
>> On 07/11/2009, at 4:17 AM, Andy Lin wrote:
>>
>>> I'm currently using linguex to typeset examples, and I've noticed  
>>> that
>>> \textipa is broken within the \ex. command/environment. Upon further
>>> investigation, it seems that even \newcommand\ipa[1]{\textipa{#1}}
>>> breaks \textipa (although \let\ipa\textipa, as mentioned in the tipa
>>> manual, is fine). I'm not sure what the problem is exactly, if it  
>>> has
>>> to do with xunicode setting capital letters as active in its textipa
>>> implementation or something else,

Yes, this is indeed related to the problem, ...

> The tipa text commands that are redefined in xunicode (e.g.
> \textturna) work great, but it's the \textipa command which is a
> little bit problematic, since xunicode's implementation of it involves
> turning A-Z, 0-9, and ;:| and @ into active characters. It works fine
> in standard paragraph mode, but it seems to break inside certain
> environments and doesn't seem to allow its inclusion in \newcommands.

  ... since the  \ex  command reads to the next (implicit) \par
before doing its work.

This means that the \catcode of any character within its argument
is frozen with the standard meaning, before \textipa  has the
chance to setup the meanings that you want them to have.

However, with the modern eTeX extensions to TeX, you can overcome
this kind of difficulty:

   \newcommand\ipa[1]{\textipa{\scantokens{#1}}}



>>> though the solution proposed there was to simply input the unicode
>>> equivalents of the IPA characters (which would break compatibility
>>> with non-unicode LaTeX), or to come up with a TECkit mapping for the
>>> IPA characters (which I'm willing to do, but only if there are no
>>> other options).
>>
>> The TECkit mapping approach is interesting, but is really only
>> applicable if you are using non-active characters, rather than
>> macros, to specify the font characters.
>>
> I ended up making a TECkit mapping soon after I posted the message
> when I realized that the \textipa command was only responsible for
> remapping 40 glyphs. I've attached the map and tec files. I've changed
> the glyph mapping for G and U, these are lowercase glyphs in tipa but
> xunicode maps them to uppercase.

Please explain this in detail, with examples.
Aaaah, you file  xetex-tipa.map  does this.

The differences seem to be:

;B > U+03B2;\textbeta  name taken for the greek letter
G > U+0263;\textgamma
;G > U+0264;\textbabygamma
;U > U+01B1;\textupsilon
U > U+028A;\textscupsilon
;Z > U+021D;\textyogh
;" > U+02B9;\textprimstress (looks like math prime)


Would it be sufficient to make the expansion of ; (active)
to check the next token and produce the appropriate
characters for ;B  ;G  ;U  ;Z  ;"  else \texthalflength  ?

If this is all that is needed, I'll adjust the  xunicode.sty
coding to implement this.


> I was reluctant to use this solution because it's an additional file
> that people have to install in order to have linguex, tipa, and XeTeX
> play together nicely.

Send a real-world example (with a PDF of what the output
should look like) so I can be sure I'm doing the right thing.


> (I'm running a LaTeX tutorial in a couple of
> weeks with people who are used to Word, and the less I ask them to dig
> around their texmf trees the better.) However, the \textipa command
> was written to map normal, non-active, basic latin characters to IPA
> glyphs so it seems that a TECkit mapping is the appropriate solution
> here.
>
>>> Has anyone run into this problem before? Can it be solved by some
>>> combination of \protect, \expandafter, etc.?

   The primitive you want to use is  \scantokens .
   This allows the \catcode to be altered for otherwise frozen
   characters.


>> Can you provide an example (La)TeX document that displays
>> some of the difficulties that you are facing.
>>
> \documentclass{article}
> \usepackage{xltxtra}
> \setmainfont{Cambria}
> \usepackage{linguex}
> %\AtBeginDocument{\def\textipa#1{{\addfontfeatures{Mapping=xetex- 
> textipa}#1}}}
> %This is the solution that I'm using now, having made the xetex- 
> textipa map
> \begin{document}
> \textipa{ABCabc} % This text renders as it should (script a, s-z,
> curly tail c, abc)
>
> \ex. \textipa{ABCabc} % This text renders as ABCabc

  \ex. \ipa{ABCabc} % This now works properly.

>
> \end{document}

> Sincerely,
> Andy Lin


Hope this helps,

	Ross

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





More information about the XeTeX mailing list