# lmodern + tipa cause first instance of diacritic to break

When I load both lmodern and tipa, the first instance of an IPA symbol with a diacritic breaks. For example, this code

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tipa}

\begin{document}

\=\textschwa
\=\textepsilon
\'\textschwa
\'\textepsilon

\end{document}


produces this:

It's always the first character that's split, regardless of which diacritic and what body you use. E.g., if I change it to

\=\textepsilon
\=\textschwa
\'\textschwa
\'\textepsilon


I get,

and if I change it to

\'\textschwa
\'\textepsilon
\=\textepsilon
\=\textschwa


it produces .

How do I change it so the first character gets its diacritic on top where it belongs?

Note that there is this question about lmodernand tipa, but it only tells us that they work fine together and don't produce problems (beyond some warnings.)

• As a workaround you can also put a schwa in a box that you don't render at the start, then this schwa receives the T3 warning and clears the way for the following diacritics, i.e., \newsavebox{\schwabox}\savebox{\schwabox}{\textschwa}%. But @egreg's answer below is more robust, of course. – Marijn Mar 13 at 13:00

You get warnings, don't you? Precisely

LaTeX Font Warning: Font shape T3/lmr/m/n' undefined
(Font)              for symbol textschwa' on input line 8.


You avoid them (and the wrong accent), with substitutefont.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tipa}
\usepackage{substitutefont}

\substitutefont{T3}{lmr}{cmr}

\begin{document}

\=\textschwa
\=\textepsilon
\'\textschwa
\'\textepsilon

\end{document}

• In fact, I don't get any warnings. I'm using overleaf, with precisely what I have written. The only thing it's complaining about is: "BibTeX No data sources defined!" I'm still wondering why I don't get warnings about the font. – sgf Mar 13 at 12:57
• @sgf If you look at the Raw Log in Overleaf the warning is there. Overleaf hides this from you. Alternatively, just wrap the code in \begin{IPA}...end{IPA}. – Alan Munn Mar 13 at 12:58

You are using tipa macros without being inside \textipa{} or the {IPA} environment which is not how they were designed to be used. To get your example to work properly you should simply wrap the examples in the correct environment.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tipa}

\begin{document}

\begin{IPA}
\=\textschwa
\=\textepsilon
\'\textschwa
\'\textepsilon
\end{IPA}

\end{document}
`