# Error TikZ with mitwpl.cls

I'm trying to use TikZ with the MIT Working Papers in Linguistics .cls file (mitwpl.cls, available here). I use the following code:

\documentclass{mitwpl}
\usepackage{tikz}
\begin{document}
test
\end{document}


When I compile it, I get multiple errors like the following:

(/usr/share/texmf/tex/generic/pgf/math/pgfmathparser.code.tex
\pgfmath@dimen=\dimen174
\pgfmath@count=\count154
\pgfmath@box=\box66
\pgfmath@toks=\toks32

! Missing \endcsname inserted.
\protect
l.134 ...lmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ}

?
! Too many }'s.
<argument> ...x @\string \ensuremath {\rm \sb {a}}

l.134 ...lmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ}

?
! Extra \endcsname.
\pgfmath@namedef ...ter \def \csname #1\endcsname

l.134 ...lmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ}

?

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.134 ...lmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ}

?


I don't understand the error messages. If I ignore them, an output is produced, like the following:

Any kind of tips or pointers are welcome! Thanks!

The class is not the best set up in the world. Here, the blocking issue is that it sets _ and ^ to non-standard category codes, which causes all sorts of issues. We can at least get things to load with

\documentclass{mitwpl}
% Make 'safe'
\catcode\^=7 %
\catcode\_=8 %
\usepackage{tikz}
% Put back 'class expected' behaviour
\catcode\^=\active
\catcode\_=\active
\begin{document}
\end{document}

• I would be very wary of this class! – Joseph Wright Dec 22 '15 at 18:48
• Yes, it's a really bad example of how not to implement a class. Especially because it provides modified versions of the example and glossing package gb4e which means that it will not reflect updates to that package. For example, the current version of gb4e contains a \noautomath command which undoes the catcode changes, but the version the class loads doesn't. – Alan Munn Dec 22 '15 at 19:31