# breqn package incompatibility

Edit: For clarity about what this post is asking, I have placed the specific questions at the beginning of the post.

I would like to understand the technical details of the incompatibilities of breqn.sty (v0.98a) with other packages in TexLive2009. These incompatibilities appear to vanish in subsequent editions of TexLive, and I would like to know what changes have been made to the remediate the incompatibilities? Lastly, what does the obscure and unhelpful error message cited below signify?

Background to contextualize the above questions:

On an amd64 linux system running TexLive 2009, I find that the package breqn (v0.98a) must be the last package loaded, otherwise it interferes with loading of certain other packages, in particular listings (v1.4), xcolor (v2.11), and graphicx (v1.0f).

Below, I include an example document that generates an error.

\documentclass{article}
\usepackage{breqn}
\usepackage{listings}
\begin{document}
Null.
\end{document}


The output (including the error message) produced upon compilation of this document with pdflatex is:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./breqn.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, nohyphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/mh/breqn.sty
(/usr/share/texmf-texlive/tex/latex/mh/flexisym.sty
(/usr/share/texmf-texlive/tex/latex/mh/cmbase.sym)
(/usr/share/texmf-texlive/tex/latex/mh/mathstyle.sty))
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty))
(/usr/share/texmf-texlive/tex/latex/listings/listings.sty
! Missing number, treated as zero.
<to be read again>
^
l.44 \lst@InputCatcodes

?


When I compile the same code on a mac osx 10.6 system running MacTeX-2011, the code compiles without error, regardless of when breqn.sty is loaded.

The following excerpt from the breqn manual (Section 6.1) does specify that such incompatibilities may occur:

As it pushes the envelope of what is possible within the context of LaTeX 2ε, the breqn package will tend to break other packages when used in combination with them, or to fail itself, when there are any areas of internal overlap; successful use may in some cases depend on package loading order.

• You should upgrade your TeX distribution. See tex.stackexchange.com/questions/1092/… which will tell you how to install the newest TeX Live on Linux. – qubyte Feb 26 '12 at 9:42
• Thank you. I was more interested in some of the technical details of why the package was causing issues in one distribution and not another. – user001 Feb 26 '12 at 10:00
• If you want an analysis, you should show a minimal example to test on. – egreg Feb 26 '12 at 10:50
• Thanks @egreg. I have added a MWE that reproduces the error on TexLive 2009. – user001 Feb 26 '12 at 10:56
• Without exact version numbers for all of the packages here, this is not going to be easy to answer. – Joseph Wright Feb 26 '12 at 11:08

## 2 Answers

The breqn package has undergone a thorough revision from the version in TeX Live 2009 to the one in TeX Live 2010 (which is identical to the version in TeX Live 2011).

The error is triggered by the fact that flexisym.sty changes the category code of ^ too early, so that a syntax such as \catcode\^^@ which is needed by listings is not legal any more: for it to work the ^ must have category code 7 and not 12.

The newer versions of the packages breqn and flexisym delay the category code change at begin document, so packages can still use the ^^ notation. This was clearly a misfeature in breqn and flexisym, but explains why loading breqn last might solve the problem.

• Thanks for the great explanation. That is exactly what I was looking for. – user001 Feb 26 '12 at 11:15
• The newer version of breqn leaves _ of catcode letter :(. That's because it's only half-translated to the expl3 syntax. – Bruno Le Floch Feb 27 '12 at 3:13

The issue needs to be traced carefully (as I don't have the old distribution is difficult to trace exactly).

However, the error can possibly as a first step be traced back to the listings package based on the error message you have provided.

The macro \lst@InputCatcodes is called if a listings.cfg file exists. Can you check the distributions to see if there are differences?

• Thanks Yiannis, I will check to see if the listings` package has changed in the two distributions. – user001 Feb 26 '12 at 11:01