[Tex/LaTex] Writing English phonetic symbols when using a different language package

languageslinguisticssymbols

I'm writing a document in Spanish language, and I'd like to introduce English phonetics for some words. Is it possible to do so?

I've tried this:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tipa}

\usepackage[utf8]{inputenc}
\begin{document}
    /fəˈnɛtɪk/
\end{document}

but it doesn't work.


I've retaken this to make some tests but it's not working for me.
I'm using the preamble provided by egreg's answer but I'm having the error \select@language{spanish}
How can I fix this?

Best Answer

If you want to use UTF-8 characters for the phonetic symbols, you have to teach them to LaTeX, because the tipa package doesn't provide support for this. Alternatively, you can input them with the shorthands provided by the package.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tipa}
\usepackage{newunicodechar}
\newunicodechar{ˈ}{"}
\newunicodechar{ə}{@}
\newunicodechar{ɛ}{E}
\newunicodechar{ɪ}{I}

\begin{document}

\textipa{/fəˈnɛtɪk/}

\textipa{/f@"nEtIk/}

\end{document}

enter image description here

How to extend the set of supported characters? Let's see, for instance,

ˌjuːnɪˈvɜːsɪtɪ

I added \textipa{/ˌjuːnɪˈvɜːsɪtɪ/} to the example above and, upon running pdflatex, I saw the errors

Unicode char ˌ (U+2CC) not set up for use with LaTeX

Unicode char ː (U+2D0) not set up for use with LaTeX

Unicode char ɜ (U+25C) not set up for use with LaTeX

Then I went to the manual of tipa, Appendix A Annotated List of TIPA Symbols and looked for the characters, just like I did for the previous ones. The last one appears like in the image below

enter image description here

so I know what shorthand to put in the second argument to \newunicodechar.

Here is the full example:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tipa}

\usepackage{newunicodechar}
\newunicodechar{ˈ}{"}
\newunicodechar{ə}{@}
\newunicodechar{ɛ}{E}
\newunicodechar{ɪ}{I}
\newunicodechar{ˌ}{""}
\newunicodechar{ː}{:}
\newunicodechar{ɜ}{3}

\begin{document}

\textipa{/ˌjuːnɪˈvɜːsɪtɪ/}

\textipa{/fəˈnɛtɪk/}

\textipa{/f@"nEtIk/}

\end{document}

enter image description here

Instead of \newunicodechar you could use

\DeclareUnicodeCharacter{025C}{3}

instead of \newunicodechar{ɜ}{3}, but I find it more convenient to have the “real” character instead of its code point.

Related Question