Closed John02139 closed 1 month ago
hm, I think the logic to reinsert \belowdisplayskip
after the tagging code is not right. We should ensure that there is no negative skip before a possible breakpoint.
\DocumentMetadata
{
testphase={phase-III,math},
pdfstandard = a-4,
pdfversion = 2.0,
lang = en-US,
}
\documentclass[11pt]{article}
\usepackage[letterpaper,margin=1in]{geometry}
\usepackage{lipsum}
\ExplSyntaxOn\makeatletter
\cs_set_protected:Npn \__math_tag_dollardollar_display_end:
{
\para_raw_end:
\tagpdfparaOn
\l__math_tmpa_skip \lastskip
\tag_socket_use:n{math/display/formula/end}
\penalty 10000
\skip_vertical:n { -\l__math_tmpa_skip } % negate the negative belowdisplayskip
\penalty \postdisplaypenalty
\skip_vertical:n { -\l__math_tmpa_skip } % reinsert it
\@doendpe % this has no \end{...} to take care of it
}
\ExplSyntaxOff\makeatother
\begin{document}
K. O. Friedrichs introduced the following model equation to explain boundary layers\footnote{In Friedrich's 1941 lecture notes on fluid dynamics, the forcing function is a constant. Other reports have cited other forcing functions, including this one and $g'(x)$. He seems to have used this equation often with various forcing functions. Prandtl reportedly used $\varepsilon y''+y'+y = 0$ a decade earlier.}:
\begin{equation}
\varepsilon \frac{d^2 y}{dx^{2}} + \frac{dy}{dx} = 1+2x \qquad \textrm{with } y(0) = 0 \textrm{ and } y(1) = 1
\end{equation}
Note that $y = y(x,\varepsilon)$. As $\varepsilon\to 0$, the highest derivative is lost: the equation becomes first order and cannot meet two boundary conditions. This fact leads to a boundary layer at one side of the domain.
\lipsum[1-5]
A perturbation expansion in $f(\varepsilon)$ for $f\to 0$ is\begin{equation}
y(z,\varepsilon) = Y_{0}(z) + f Y_{1}(z) + f^{2} Y_{2}(z) + \cdots
\end{equation}
\end{document}
@FrankMittelbach does that look correct?
Wrong sign on the reinsert?
No the sign is fine. The first equation in the document shows that (as wanted) first a negative glue is inserted and then the double positive to compensate:
...\penalty 10000
...\glue(\belowdisplayskip) -11.0 plus -3.0 minus -6.0
...\penalty 0
...\glue 22.0 plus 6.0 minus 12.0
but after the second equation the compensation is lost at the page break:
...\penalty 10000
...\glue(\belowdisplayskip) -11.0 plus -3.0 minus -6.0
...\glue 10.0 plus 4.0 minus 2.0
...\kern-3.0
With my fix one gets there
...\penalty 10000
...\glue(\belowdisplayskip) -11.0 plus -3.0 minus -6.0
...\penalty 10000
...\glue 11.0 plus 3.0 minus 6.0
...\glue 10.0 plus 4.0 minus 2.0
...\kern-3.0
which in the sum is the same what you get without math tagging:
...\glue 10.0 plus 4.0 minus 2.0
...\kern-3.0
I realized that by now. yes your code is correct. first we have to get back to the same position before belowskip is is added (without a break point) and then we have to insert postpenalty and the real belowskip, so yes your adjust is the right one. I make an update.
Confirming that this issue is fixed in -dev
, and closing.
With math tagging:
Without math tagging: