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

Some math fonts show misaligned \Bigg\vert when math tagging is active #757

Open
John02139 opened this issue Nov 8, 2024 · 5 comments
Open
Labels
area: math bug Something isn't working in code we maintain (directly)

Comments

@John02139
Copy link

Screenshot 2024-11-08 at 9 08 05 AM
\DocumentMetadata 
{
	testphase={phase-III,math},
	pdfstandard = a-4f,
	pdfversion  = 2.0,
	lang		= en-US,
}
\documentclass[11pt]{article}

\usepackage{unicode-math}

\setmathfont{STIXTwoMath-Regular}[
	Extension = .otf,
	Scale=MatchUppercase,
]
%\setmathfont{texgyretermes-math}[
%    	Extension = .otf,
%    	Scale=MatchUppercase,
%]
%\setmathfont{texgyrepagella-math}[
%    	Extension = .otf,
%    	Scale=MatchUppercase,
%]
%\setmathfont{LucidaBrightMathOT}[%
%	  Extension=.otf,
%	  Scale=MatchUppercase,
%	  BoldFont=LucidaBrightMathOT-Demi.otf,
%]
%\setmathfont{Asana-Math}[
%    	Extension = .otf,
%    	Scale=MatchUppercase,
%]
%\setmathfont{FiraMath-regular}[
%    	Extension = .otf,
%    	Scale=MatchUppercase,
%]
%\setmathfont{GFSNeohellenicMath}[
%    	Extension = .otf,
%    	Scale=MatchUppercase,
%]
%\setmathfont{libertinusmath-regular}[
% 	Extension = .otf,   
%	Scale=MatchUppercase,
%	]

\begin{document}
The \verb+\Bigg\vert+ is vertically misaligned when math tagging is active if certain math fonts are loaded.
\begin{equation}
\int_{\Gamma^h_s}\frac{\partial}{\partial n_x}\int_{\Gamma^a_\xi} \mkern-3mu b(\xi) \frac{\partial E(x|\xi)}{\partial n_\xi} \,dl_\xi \Bigg\vert_{x\to s}\,dl_s = 0 
\end{equation}
This behavior occurs for Stix2, TeX Gyre fonts,  and Lucida; but NOT for FiraMath, GFSNeohellenicMath, Libertinus, or default LMR.   
\end{document}
@u-fischer
Copy link
Member

luamml changes \bBigg@ to use a luatex primitive, so it looks as if that doesn't work properly for some fonts:

\documentclass[11pt]{article}
\usepackage{unicode-math}

\setmathfont{STIXTwoMath-Regular}[
	Extension = .otf,
	Scale=MatchUppercase,
]
\makeatletter
\ExplSyntaxOn
\cs_set:Npn \bBigg@ #1 #2 {
  {
    \ensuremath {
      \Uvextensible height~#1 \big@size axis~exact~#2
    }
  }
}
\makeatother
\ExplSyntaxOff
\begin{document}
The \verb+\Bigg\vert+ is vertically misaligned when math tagging is active if certain math fonts are loaded.
\begin{equation}
\int_{\Gamma^h_s}\frac{\partial}{\partial n_x}\int_{\Gamma^a_\xi} \mkern-3mu b(\xi) \frac{\partial E(x|\xi)}{\partial n_\xi} \,dl_\xi \Bigg\vert_{x\to s}\,dl_s = 0 
\end{equation}
This behavior occurs for Stix2, TeX Gyre fonts,  and Lucida; but NOT for FiraMath, GFSNeohellenicMath, Libertinus, or default LMR.   
\end{document}

@davidcarlisle @zauguin thoughts?

@davidcarlisle
Copy link
Member

@u-fischer the luatex manual isn't exactlyclear but if you force height and depth to be half the requested size rather than relying on axis to shift then it's closer to the intended layout

      \Uvextensible height~#1~ \dimexpr0.5\big@size\relax ~ depth ~#1~  \dimexpr0.5\big@size\relax~ axis~~#2

@davidcarlisle
Copy link
Member

actually having got clarification in chat axis does not re-centre the entire delimiter on the axis, just interprets height and depth relative to that, so the code you originally showed should have a depth component as well (not clear why it appears to work in some cases without)

@u-fischer
Copy link
Member

So you can try with definition which should go after \begin{document}

\makeatletter
\ExplSyntaxOn
\cs_set:Npn \bBigg@ #1 #2 {
  {
    \ensuremath {
      \Uvextensible height~#1~ \dimexpr0.5\big@size\relax ~ depth ~#1~  \dimexpr0.5\big@size\relax~ axis~exact~#2
    }
  }
}
\makeatother
\ExplSyntaxOff

@John02139
Copy link
Author

Thanks, that code works with all the fonts I tried.

@FrankMittelbach FrankMittelbach added bug Something isn't working in code we maintain (directly) area: math labels Nov 14, 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)
Projects
None yet
Development

No branches or pull requests

4 participants