[XeTeX] xunicode and TIPA
Alan Munn
amunn at gmx.com
Thu Jul 29 00:34:14 CEST 2010
On Jul 28, 2010, at 5:37 PM, Ross Moore wrote:
> Hi Ulrike and Alan,
>
> On 29/07/2010, at 4:03 AM, Ulrike Fischer wrote:
>
>>> I know the definition for the IPA environment isn't correct; what I
>>> want is characters inside that environment to be interpreted in the
>>> same way that they are within the \textipa command provided by
>>> xunicode.
>>
>> You must use a name with small letters for your environment (tipa
>> activates the others)
>>
>> \documentclass{article}
>> \usepackage{xltxtra}
>> \newfontfamily{\ipafont}{Doulos SIL}
>> \def\useTIPAfont{\ipafont}
>> \newenvironment{ipa}{%
>> \let\stone\TIPAstonebar
>> \let\tone\TIPAtonebar
>> \setTIPAcatcodes\activatetipa
>> \csname useTIPAfont\endcsname
>> }{}
>> \begin{document}
>> \textipa{RPAQIOE} % This will give you correct phonetic characters
>> \begin{ipa}
>> RPAQIOE
>> \end{ipa}
>>
>> \end{document}
>
> You can take the extra step to be able to use
> \begin{IPA}
> ...
> \end{IPA}
>
> viz.
>
>>>> \documentclass{article}
>>>> \usepackage{xltxtra}
>>>> \newfontfamily{\ipafont}{Doulos SIL}
>>>> \def\useTIPAfont{\ipafont}
>>>> \newenvironment{ipa}{%
>>>> \let\stone\TIPAstonebar
>>>> \let\tone\TIPAtonebar
>>>> \setTIPAcatcodes\activatetipa
>>>> \useTIPAfont % no need for \csname here
>>>> }{}
>>>> \let\realend\end
>>>> \let\endIPA\endipa
>>>> \def\IPA{\let\end\ipaspecialend\ipa}% change how \end works
>>>> inside IPA envs
>>>> \def\endendipa{\end{IPA}}
>>>> {\catcode`I = \active \catcode`P = \active \catcode`A= \active
>>>> \gdef\foundendipa{IPA}%
>>>> \gdef\ipaspecialend#1{\def\testforipa{#1}%
>>>> \ifx \testforipa \foundendipa\expandafter\endendipa
>>>> \else\realend{#1}%
>>>> \fi}%
>>>> }% end of \catcode changes
>>>>
>>>> \begin{document}
>>>> \textipa{RPAQIOE} % This will give you correct phonetic characters
>>>> \begin{ipa}
>>>> RPAQIOE
>>>> \end{ipa}
>>>>
>>>> RPAQIOE
>>>>
>>>> \begin{IPA}% So will this!
>>>> RPAQIOE
>>>> \end{IPA}
>>>>
>>>> \end{document}
>
> But do *not* try to nest these environments.
> If you have macros expanding to use such environments,
> then there is no guarantee that these will work properly.
>
> I think they will, since the definitions will have been
> made with non-active letters, but have not tested it.
>
> Writing out IPA environments into auxiliary files is
> almost certain to *not* work.
> But test it, if you need this kind of feature.
>
Thanks, Ross. What I'm mainly looking for is a fairly simple way of
using legacy TIPA code, and I don't know whether this would cause any
problems or not. I also don't quite know how much xunicode itself
emulates TIPA and how much it doesn't. Right now there are various
things that don't work, but I don't know enough about how xunicode
works (and probably the relevant fonts themselves) to make a new
package that would make the emulation more complete.
For example, (and not surprisingly) the following commands are defined
in TIPA, but don't work with xunicode:
\*<char> depending on <char> produces the turned version of <char> for
{fkrtw} or a specific other character for {jnhlz} else a non-IPA
version of <char>
\;<char> produces a small caps version for {EJAHLUBGNR}
\:<char> produces a retroflex version for {dlnrRstz}
etc.
These commands are defined in the following way in tipa.sty
\DeclareTextCommand{\:}{T3}[1]{#1}
\DeclareTextAccentDefault{\:}{T3}
\DeclareTextComposite{\:}{T3}{d}{227}
etc.
If I were to do the same thing using xunicode how would I do it?
Also (and more suprisingly) \c{c} doesn't seem to work, but gives
Undefined control sequence \realLaTeXcedilla
Anyway, I'd be happy to do some of the work, but I'm somewhat in the
dark as to how to start.
Thanks
Alan
--
Alan Munn
amunn at gmx.com
More information about the XeTeX
mailing list