Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

math tagging produces misaligned footnote below equation #721

Open
John02139 opened this issue Sep 30, 2024 · 4 comments
Open

math tagging produces misaligned footnote below equation #721

John02139 opened this issue Sep 30, 2024 · 4 comments
Assignees
Labels
area: math bug Something isn't working in code we maintain (directly) fixed in branch fixed in a branch different to develop

Comments

@John02139
Copy link

\DocumentMetadata 
{
	testphase={phase-III,math},
	pdfstandard = a-4,
	pdfversion  = 2.0,
	lang		= en-US,
}

\documentclass[11pt]{article}
\usepackage[letterpaper,margin=1in]{geometry} 
\usepackage{lipsum}

\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}

With math tagging:
Screenshot 2024-09-30 at 11 44 04 AM

Without math tagging:
Screenshot 2024-09-30 at 11 44 22 AM

@u-fischer
Copy link
Member

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?

@FrankMittelbach
Copy link
Member

Wrong sign on the reinsert?

@u-fischer
Copy link
Member

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

@FrankMittelbach
Copy link
Member

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.

@FrankMittelbach FrankMittelbach self-assigned this Sep 30, 2024
@FrankMittelbach FrankMittelbach added bug Something isn't working in code we maintain (directly) area: math fixed in branch fixed in a branch different to develop labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: math bug Something isn't working in code we maintain (directly) fixed in branch fixed in a branch different to develop
Projects
None yet
Development

No branches or pull requests

3 participants