The BioMed Central LaTeX class, bmcart.cls
, redefines \end
in a manner that causes downstream errors when used in conjunction with breqn.sty
.
The offending portion of bmcart.cls
is provided below:
\def\end#1{%
\@ifundefined{pseudo@#1}%
{\org@end{#1}}{\csname pseudo@#1\endcsname[1]\relax}%
}
This modified definition of \end
is used by the class to permit the function of a new syntax element, \newpseudoenvironment
, which appears to be used by the publisher to define global definitions in a more convenient fashion.
Unfortunately, breqn
also redefines \end
, in an incompatible manner. When breqn
is loaded after the bmcart
class, the following error occurs:
Runaway argument?
\@ifundefined {pseudo@##1}{\org@end {##1}}{\csname pseudo@##1\endcsname \ETC.
/usr/share/texlive/texmf-dist/tex/latex/breqn/breqn.sty:848: Paragraph ended be
fore \@tempa was complete.
<to be read again>
\par
l.848 \par
If the above lines of bmcart.cls
are commented out, this error does not occur.
With the help of LianTze Lim and Graham Douglas, I am now storing the LaTeX default definition of \end
and then restoring it after loading bmcart.cls
, also storing its definition. This current patch is provided as an answer to this question.
While this solution allows my project to compile, it does not completely fix the underlying issue, in that it does not allow \newpseudoenvironment
to function (see lines 302–320 of bmcart.cls
for its definition and its associated re-definitions of \start
and \end
), as intended (which may be needed by the publisher). More generally, it would be nice to find a solution that allows breqn
to use its definition of \end
, while allowing all other packages to use the applicable default or class-specific definition.
We provide below the definitions of various \end
commands, kindly compiled by Graham Douglas:
\latexend:
\csname end#1\endcsname \@checkend {#1}\expandafter \endgroup
\if@endpe \@doendpe \fi \if@ignore \@ignorefalse \ignorespaces \fi
\brqend:
\csname end#1\endcsname \latex@end {#1}
\latex@end:
\@checkend {#1}\expandafter \endgroup \if@endpe \@doendpe
\fi \if@ignore \@ignorefalse \ignorespaces \fi
\org@end:
\csname end#1\endcsname \@checkend {#1}\expandafter \endgroup
\if@endpe \@doendpe \fi \if@ignore \@ignorefalse \ignorespaces \fi
\bmcend:
\@ifundefined {pseudo@#1}{\org@end {#1}}{\csname pseudo@#1\endcsname
[1]\relax }
Can anyone suggest an improved solution, which accomplishes one of the following things (or suggests some better alternative)?
- Encapsulates the
breqn
definition of\end
such that it does not cause compatibility issues, but is still used for allbreqn
environments. - Encapsulates the
bmcart.cls
definition of\end
such that it does not cause compatibility issues, but allows its pertinent case ofpseudo@#1
to be defined automatically and used only by\newpseudoenvironment
. - Restores the
bmcart.cls
definition of\end
after loadingbreqn.sty
, but still manages to permitbreqn
environments, likedmath
, to function correctly.