latex-lineno / lineno

lineno – Line numbers on paragraphs
Other
11 stars 2 forks source link

linenomath environment doesn't work fully with breqn displays #4

Closed FrankMittelbach closed 1 year ago

FrankMittelbach commented 1 year ago

The lineno package, does now automatically supports amsmath environments, but of course there are others. For that there is the linenomath environment but in case of dmath from breqn that doesn't fully work: the last line in front of the display is not getting a line number. It can be fixed by ading a \parbut I doubt that this is the right solution.

MWE:

\documentclass{article}

\usepackage{breqn}
\usepackage{lineno,kantlipsum}
\begin{document}

\linenumbers

\kant*[1][1]
Hello world
\begin{dmath}
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x
\end{dmath}
\kant*[2] Another breqn test:
\begin{linenomath}
\begin{dmath}
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x
\end{dmath}
\end{linenomath}
\kant[4][1]

\AddToHook{env/dmath/before}{\par\begin{linenomath}}       % this makes it work
\AddToHook{env/dmath/after}{\end{linenomath}}              % automatically

\kant*[2] Another breqn test:
\begin{dmath}
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x+y+z+t+x+y+z+t+x+y+z+t+x+y+z+t+
x
\end{dmath}
\kant[4][1]

\end{document} 
kwwette commented 1 year ago

I had a quick look at this, but ran into quite a few issues:

Given all that and my limited time I'm afraid this is a wont-fix for now.

FrankMittelbach commented 1 year ago

@kwwette understood, and I'm not surprised. I mainly reported it so that it is documented as an issue (and possibly an issue one has to live with it for the forseeable future. breqn is doing so much surgery to the standard processing that it is surprising that it more or less works at all.

kwwette commented 1 year ago

Closing this issue as this is unlikely to be fixed. The issue tracker will still document the problem for posterity.