[XeTeX] Extra trailing space in IPA font with xltxtra

Ross Moore ross.moore at mq.edu.au
Wed Sep 22 21:46:59 CEST 2010


Hi Andy, Ulrike, Paolo, Heiko,

On 23/09/2010, at 4:37 AM, Andy Lin wrote:

> \scantokens is my fault. I noticed that the IPA support in xunicode
> didn't work with the linguex package, and Ross suggested the use of
> \scantokens. I haven't tried to use linguex with xunicode recently,
> but to give you an idea of where it used to fail:
> 
> \documentclass{article}
> \usepackage{xltxtra} %or xunicode
> \usepackage{linguex}
> \setmainfont{Charis SIL}
> \begin{document}
> \ex. \textipa{DOES THIS WORK?} %would give DOES THIS WORK? instead of
> the textipa replacements
> 
> 
> \end{document}

\ex is reading ahead, before knowing about the catcode changes
needed to make \textipa  do its thing.
Hence the need to rescan the tokens.
I knew nothing about the extra space being inserted at the end.
Why is this? Is there a good reason for it, or is it really
just a buggy implementation in the internals of eTeX ?

Anyway, being what it is, including the \endlinechar=-1
as follows (in xunicode.sty) certainly fixes the immediate problem:

>>> \expandafter\ifx\csname scantokens\endcsname\relax
>>>  \def\implementTIPAtextx#1{#1\egroup}
>>> \else
>>> % \def\implementTIPAtextx#1{\scantokens{#1}\egroup}
>>>  \def\implementTIPAtextx#1{\endlinechar=-1 \scantokens{#1}\egroup}
>>> \fi

However, I'm not convinced that this is the most robust way
of tackling this issue.
Should it be localised to just when  linguex  is used?


Here is how I think this kind of interaction-between-packages
specific kind of issue should be solved. What do you think?

>>> \def\implementTIPAtextx#1{#1\egroup}
>>> \def\implementTIPAtextxx#1{\endlinechar=-1 \scantokens{#1}\egroup}
>>> \AtBeginDocument{\let\textipa\implementTIPAtext}
>>> \expandafter\ifx\csname scantokens\endcsname\relax 
>>> \else
>>>  \AtBeginDocument{\@ifpackageloaded{linguex}{%
>>>   \let\implementTIPAtextx\implementTIPAtextxx}}
>>> \fi


If everyone agrees, this is how the next subversion
of Xunicode will deal with this.

> If it works with linguex, that's great. If not, and you need textipa
> with linguex, I have a TECkit mapping I can upload that converts
> uppercase and numeric input into their textipa forms.

Yes, using a TECkit mapping is a good solution.
But that is specific to XeTeX only, isn't it?
People are wanting to use Xunicode also with LuaTeX, so there 
would need to be an alternative solution in that context (sic).

> 
> -Andy



Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at 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