wspr / breqn

Automatic line breaking in LaTeX equations
18 stars 2 forks source link

fix amsmathcode code #45

Closed u-fischer closed 3 years ago

u-fischer commented 3 years ago

flexisym packages \@begindocumenthook to remove code from amsmath. This will break with the next latex due to the changes in the hook management.

\documentclass{article}

\usepackage{breqn}

\begin{document}
\begin{dmath}  0 \hiderel{<} x =
  x_0 + x_1 + x_2 + x_3 + \dots + x_{n-1} + x_n
\end{dmath}
\end{document}

will error with

Runaway argument?
\g__hook_begindocument_code_tl \flexi@stop \endgroup \AtBeginDocument \ETC.
! File ended while scanning use of \next.
<inserted text> 
                \par 

The pull request tries to repair this

I hope this is the right plan.

I didn't try to add some rule for the hook order: According to the docu, flexisym has to be loaded after amsmath. I also didn't try to check or ensure compability with unicode-math as imho breqn can't be used with it anyway.

FrankMittelbach commented 3 years ago

would that work if a new breqn is loaded into an older release? (or one that has been rolled back?)

u-fischer commented 3 years ago

@FrankMittelbach if it works at all it should work everywhere. It doesn't depend on the hook management. Basically it delays the setting of the new flexisym mathcodes for - and = to a point after amsmath has stored them in \std@minus. The main question is if the flexisym mathcodes are needed somewhere in the preamble, then it would fail (I didn't see anything obvious, and the tests passed).