[Tex/LaTex] Filtering font substitution warnings caused by the combination of lmodern and tipa

fontslatin-modernlinguisticstipawarnings

This question is a follow-up to Combining lmodern and tipa: I tried to filter the harmless warnings that occur when using tipa with the Latin Modern font. Doing so crashes both pdflatex and regular latex.

I haven't tested this on any OS other than Windows yet.

\documentclass{article}
\usepackage{lmodern}
\usepackage[]{tipa}
\usepackage{silence}
\WarningFilter{latexfont}{LaTeX Font Warning}
\begin{document}
\textipa{\textesh}
\end{document}

Log:

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\lm\lmodern.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tipa\tipa.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tipa\t3enc.def"
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\lm\ot1lmss.fd"))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ot1enc.def")))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\silence\silence.sty")
(C:\Users\removed\test.aux)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tipa\t3cmr.fd")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\lm\ot1lmr.fd")
pdflatex: Windows API error     87: Falscher Parameter.
pdflatex: Data:       C:\removed\AppData\Local\MiKTeX\2.9\miktex/data/le\df2c24cb21984fa85003c1ecc818ff83.fndb

Best Answer

It seems like a bug in silence.sty; it doesn't show if we patch \wrong@fontshape:

\documentclass{article}
\usepackage{silence,etoolbox}
\makeatletter
\patchcmd{\wrong@fontshape}{\@gobbletwo}{}{}{}
\makeatother
\WarningFilter{latexfont}{Font shape}
\WarningFilter{latexfont}{Some font}
\usepackage{lmodern}
\usepackage[]{tipa}
\begin{document}
\textipa{\textesh}
\end{document}

The \@gobbletwo command is what disturbs silence working. It won't have side effects, other than a spurious "on input line xx" in the .sil file (if it's created).

Update

Version 1.4 of silence.sty (2011/12/06) fixes the problem.