Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing a project about phonetics using the tipa package. The problem is, I need to publish two separate versions of my project using different phonetic notation standards. When considering the fact that there is, fortunately, a one-to-one correlation between the symbols of these two standards, I would like to know if there is a way to convert from the one standard to the other without having to write everything twice?

Furthermore, since I am only using a small selection of the symbols available in tipa, I would like to use a custom syntax which eases typing.

What I need to create is a command phone in which I can type phonetic writing using my own custom syntax. The phone command is then supposed to convert this into the tipa syntax. If that is possible, all I have to do to convert between these two standards is to change this command.

An example: Since I'm using \textraiseglotstop and \textsubarch{5} a lot, I would phone to replace ? with \textraiseglotstop and R with \textsubarch{5}.

If somebody can provide me with a command that enables me to make lots of substring conversions without causing conflicts, I think that would suffice. Other suggestions are also very welcome, though.

share|improve this question
    
Are the two transcriptions systems ever found in the same document? Or are they distinct in each version? –  Alan Munn Dec 11 '12 at 18:44
    
They are going to be distinct. However, if possible, I wouldn't mind having both at my disposal so that I could make a conversion table, but it's not strictly necessary. But maybe the best is to have two commands: \standard1 and \standard2. Then \phone can be set to either depending on which version of the document is to be produced. ;-) –  Gaussler Dec 11 '12 at 18:48
add comment

1 Answer

up vote 3 down vote accepted

The simplest way to do this would be to use macros for the variant characters and use a conditional to switch between them. Here's a simple example:

\documentclass{article}
\usepackage{tipa}
\newif\ifregularIPA
\regularIPAtrue
\newcommand*{\GS}{\ifregularIPA\textglotstop\else\textsuperscript{?}\fi}
\begin{document}
\begin{IPA}
\GS aral

\regularIPAfalse
\GS aral
\end{IPA}
\end{document}

output of code

For the different versions of the document you would set the switch once in the preamble. For making a table of conversions you can set the switch inside a group.

share|improve this answer
    
Thanks :-) ... But is it not possible to create a command phone so that \phone{?aral} is equivalent to \textipa{\textraiseglotstop{}aral}? –  Gaussler Dec 11 '12 at 18:56
    
I don't see what you gain from doing that. You need some markup for IPA anyway, so I don't see the difference between \phone{?aral} and \textipa{\GS aral}. Or is your problem actually a different one, and you have things already in some orthographic form and you want to translate them to IPA. That's a different problem. But if you're entering the elements directly, this method is really the simplest. –  Alan Munn Dec 11 '12 at 18:59
    
Well, only the fact that it takes much less time to type when writing a long project ;-). What I want is to let the project rely entirely on my custom syntax, assigning a one-letter code to all the symbols I'm going to use :-). And I'm going to write the project from scratch using this system. ;-) –  Gaussler Dec 11 '12 at 19:03
    
While this is possible, (involves making characters 'active') it's likely to cause more problems than it's worth. You can just as easily configure your editor to enter the markup in a single keystroke if you want to save typing time. –  Alan Munn Dec 11 '12 at 19:09
1  
I don't want to belabor the point, but I really think this is very much a case of the XY Problem. –  Alan Munn Dec 12 '12 at 2:54
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.