# Conflict between empheq and tocdepth? [duplicate]

I have reduced my problem to a MWE and I have no idea what is going on.

The following code compiles and functions as expected when I remove the empheq package:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{empheq} %Put boxes around multiline equations/equation environments

\begin{document}

\tableofcontents

\section{blahsec1}
\subsection{blah1}
\subsection{blah2}
\section{blahsec2}
\subsection{blah1}
\subsection{blah2}

\end{document}


However, when I add the empheq package, I get the following error:

Missing number, treated as zero.

\begingroup l.5 ...oup \aftergroup \calc@B \calc@A \begingroup \aftergroup \calc@B \calc... A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

! Missing number, treated as zero. \afterassignment l.5 ...aftergroup \calc@B \calc@A \afterassignment \def {\GenericError {(cal... A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

## marked as duplicate by Alan Munn, Community♦Feb 10 '18 at 19:58

• Add \protect before the \setcounter command. – Alan Munn Feb 10 '18 at 19:47
• We can close as a duplicate of this question: addtocontents not working with certain other packages (empheq loads mathtools). – Alan Munn Feb 10 '18 at 19:54