3

I was trying breqn again to see if I can use it. I found something strange. The same latex file produces different looking output when compiled with TL 2021 on linux vs. earlier TL versions.

I found what seems to confuse it. It is the \left( and \right). Compare this

\documentclass[12pt]{book}
\usepackage{amsmath} 
\usepackage{breqn}
\begin{document}

\begin{dgroup}
\begin{dmath}
 y_h(x) = \left(x\right)+ y
\end{dmath}
\end{dgroup}

\begin{dgroup}
\begin{dmath}
 y_h(x) =(x)+ y
\end{dmath}
\end{dgroup}

\end{document}

Compiled with lualatex gives

enter image description here

The first one is bad due to using \left( and \right). Removing these fixes the problem. But this is auto-generated latex and it uses \left( and \right) everywhere. something changed in latest TL to cause this. Compiling the above with earlier TL version 2020 gives correct output for both cases.

UPDATE oct 19, 2021

The fix proposed in the answer below unfortunately does not fix some other case I just found. I do not know if this below is a new issue and needs to be put in a new question or if it the same problem. But consider this MWE

\documentclass[11pt]{book}          
\usepackage{amsmath}
\usepackage{breqn}

%add proposed fix
\AddToHook{env/dgroup/begin}{\csname tex_everypar:D\endcsname{}}

\begin{document}

Substituting the above back into the ode gives
\begin{dmath*}
2 x^{2} \left(x^{2}+x +1\right) \left(\sum_{n=0}^\infty \left(n +r \right) \left(n +r -1\right) a_{n} x^{n +r -2}\right)
   +x \left(11 x^{2}+11 x +9\right) \left(\sum_{n=0}^\infty \left(n +r \right) a_{n} x^{n +r -1}\right)
   +\left(7 x^{2}+10 x +6\right) \left(\sum_{n=0}^\infty a_{n} x^{n +r}\right) = 0       
\end{dmath*}
        
\end{document}

When compiling the above using latest TL 2021 it gives this output

>lualatex foo.tex
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021)
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2021-06-01> patch level 1
 L3 programming layer <2021-10-17>
....
Output written on foo.pdf (1 page, 59924 bytes).
Transcript written on foo.log.

enter image description here

When compiling using TL 2020 instead, and without the fix code in there, this is the output

>lualatex foo.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2020-10-01> patch level 4
 L3 programming layer <2021-02-18>
....
Output written on foo.pdf (1 page, 59964 bytes).
Transcript written on foo.log.

enter image description here

As you can see, the fix did not work here. But I do not know if this is a new issue or not. If it is, I can make new question about it.

FYI. Added issue ticket at https://github.com/wspr/breqn/issues/52

1
  • 1
    I get the same bad output using upgraded TeX Live 2021 (win 10/fedora 35) Oct 19 '21 at 0:19
3

The new paragraph hook code is interfering with breqn. The following is hitting it with a sledgehammer and disables a large part of that mechanism within the scope of dmath but works in this case

\documentclass[12pt]{book}
\usepackage{amsmath} 
\usepackage{breqn}
\AddToHook{env/dgroup/begin}{\csname tex_everypar:D\endcsname{}}
\begin{document}



\begin{dgroup}
\begin{dmath}
 y_h(x) = \left(x\right)+ y
\end{dmath}
\end{dgroup}


\begin{dgroup}
\begin{dmath}
 y_h(x) =(x)+ y
\end{dmath}
\end{dgroup}

\end{document}

enter image description here

3
  • Thanks. But the fix did not work on a new example I just added. If you think the new example is not related, I can make it a new question and remove it from here.
    – Nasser
    Oct 19 '21 at 23:48
  • 1
    @Nasser the fix at github.com/wspr/breqn/tree/gh52 fixes both, basically the fix above would work but you need it for all breqn code but there isn't a single top level environment, it's dgroup here and dmath* in your second example The fix that's being tested in the branch at the above link fixes the internal handling rather than patching the top level environment so applies in all cases (hopefully) Oct 20 '21 at 6:51
  • OK thanks for the info. I will wait and check TL update when this is fixed in sources.
    – Nasser
    Oct 20 '21 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.