Unexpected and probably wrong “Too deeply nested” error with De Gruyter template

I'm using the De Gruyter template for the PETS conference, here is a direct link (ZIP). I'm getting a "Too deeply nested" error, and relevant searches only led to "reasonable" reasons why I could get this error (lists with more than 7 levels of nesting, or trailing open environments). Here is a minimal working example that shows that the problem must be elsewhere:

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{plain}
\newtheorem{prop}{\protect\propositionname}

\usepackage[big]{dgruyter_NEW}
\usepackage{babel}
\providecommand{\propositionname}{Proposition}

\begin{document}

\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}

\begin{prop}
woo prop
\begin{enumerate} % this is where it fails
\item woo item
\item woo other item
\end{enumerate}
\end{prop}

\end{document}


The weird thing is that deleting one of the dummy prop environments fixes the problem: I don't get the error anymore. Maybe the \end{prop} lines aren't taken into account or something?

Online, people suggest to add the lines:

\usepackage{enumitem}
\setlistdepth{9} % or some bigger number


This technically works (no more errors, if I set it to 30 for my article), but the placement and indentation of enumerate or itemize environments is all wrong:

Finally, I tried the debugging technique in this answer and added a \stop right before the \begin{enumerate}. The output seems correct, but not consistent with the "too deeply nested" error:

(\end occurred inside a group at level 1)
### semi simple group (level 1) entered at line 32 (\begingroup)

• dgruyter_NEW file loads amsthm already – user31729 Jun 15 '17 at 9:22

You're unfortunately bound to using a buggy package. :-(

You can fix the error by loading the package before defining new theorems.

It's usually better first to load packages and then doing setup, in general. The style file loads amsthm and provides the dgthm and dgdef theorem styles.

\documentclass{article}
\usepackage[big]{dgruyter_NEW}

\theoremstyle{dgthm} % not plain
\newtheorem{prop}{\protect\propositionname}
\providecommand{\propositionname}{Proposition}

\begin{document}

\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}
\begin{prop}
woo prop
\end{prop}

\begin{prop}
woo prop
\begin{enumerate} % this is where it fails
\item woo item
\item woo other item
\end{enumerate}
\end{prop}

\end{document}

• Thanks! This works, but unfortunately not for my workflow, since I'm using LyX and I can't easily add something before the part of the preamble that is automatically added by LyX. It seems I have to go create my own layout to avoid this =/ – Ted Jun 15 '17 at 9:29
• @Ted I don't consider LyX as a good tool for writing in LaTeX, sorry. – egreg Jun 15 '17 at 9:31
• Additionally, it seems that even without the LyX shenanigans, loading dgruyter_NEW before amsmath or even not amsmath at all (like your example) isn't enough to make this bug go away. I've written another minimal example that raises the same error. – Ted Jun 15 '17 at 11:16

the package doesn't work with amsthm lodaed first (it loads amsthm but modifies some definitions later).

But changing the three lines marked makes it more or less work (the first line is an unrelated problem that has come up before, the redefinition of \p@ used by this package completely breaks latex, I am surprised to see the package still being distributed with that in)

\$ diff dgruyter_NEW.sty~ dgruyter_NEW.sty
22c22
< \p@=1bp
---
> %NO!!!!!!\p@=1bp
1379c1379,1380
---
> %NO  \global

• People at DG know better than you. ;-) – egreg Jun 15 '17 at 9:30
My first guess is a bad interaction between dgruyter_NEW and amsthm packages. If you import the dgruyter_NEW first it should work.