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

mathtools: lualatex-dev with tagging produces errors #734

Open
John02139 opened this issue Oct 15, 2024 · 3 comments
Open

mathtools: lualatex-dev with tagging produces errors #734

John02139 opened this issue Oct 15, 2024 · 3 comments
Assignees

Comments

@John02139
Copy link

I just updated to the new lualatex-dev, and a working code then showed some problems.

\DocumentMetadata 
{
	testphase={phase-III,math},
	pdfstandard = a-4,
	pdfversion  = 2.0,
	lang		= en-US,
}
\documentclass[11pt]{article}

\usepackage{mathtools}

\begin{document}

%% issue #1 - misaligned \Bigg\vert when tagging is in effect
\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}

%% issue #2 - multlined and tagging don't play together
\begin{align}
S^i & =  \int_{\Gamma^h_{\mkern-4mu s}} \frac{\partial \theta}{\partial n_s} \, dl_s \\
    &   
    \begin{multlined}
    	=\int_{\Gamma^h_{\mkern-4mu s}} \frac{a(s)}{2}\, dl_s + \int_{\Gamma^h_{\mkern-4mu s}} \int_{\mathcal{C}_\xi}a(\xi) \frac{\partial E(\xi|s)}{\partial n_s} \, dl_\xi dl_s 
	\\ +\int_{\Gamma^h}\lim_{x\to s^-} \frac{\partial}{\partial n_x}\int_{\Gamma^a} \mkern-3mu b(\xi) \frac{\partial E(x|\xi)}{\partial n_\xi} \,dl_\xi dl_s 
    \end{multlined}
\end{align}

\end{document}

When math tagging is active, \Bigg\vert is vertically misaligned (does not affect \vert by itself).

Screenshot 2024-10-15 at 4 36 25 PM

In addition, I get the following errors from the second equation (seem to be related to multlined / mathtools):

...e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:89: assertion failed!
stack traceback:
	[C]: in function 'assert'
	...e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:89: in function <.
..e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:81>.
\endaligned ...amml_amsmath_finalize_inner_table: 
                                                  
l.25 \end{align}
              
? 
...e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:89: assertion failed!
stack traceback:
	[C]: in function 'assert'
	...e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:89: in function <.
..e/2024/texmf-dist/tex/lualatex/luamml/luamml-amsmath.lua:81>.
\endaligned ...amml_amsmath_finalize_inner_table: 
                                                  
l.25 \end{align}

Neither problem appears without math tagging or with current versions of lualatex, pdftex, or pdftex-dev.

(I'm not sure whether these are symptoms of the same problem or two separate problems.)

@John02139
Copy link
Author

Note - The first error disappears if I load unicode-math with lualatex-dev, but the second does not. However, neither problem exists unless I run the lualatex-dev version (with or without unicode-math).

@u-fischer
Copy link
Member

well @zauguin will have to confirm, but I think the mathtools environment needs this patch (but the resulting mathml is imho not correct yet).

\DocumentMetadata 
{
	testphase={phase-III,math},
	pdfstandard = a-4,
	pdfversion  = 2.0,
	lang		= en-US,
}
\documentclass[11pt]{article}

\usepackage{mathtools}
\ExplSyntaxOn\makeatletter
\renewcommand*\MT_mult_internal:n [1]{
 \MH_if_boolean:nF {outer_mult}{\alignedspace@left} %<-- requires amsmath 2016/11/05
  \MT_next:
  \bgroup
    \Let@
    \def\l_MT_multline_lastline_fint{0 }
    \chardef\dspbrk@context\@ne \restore@math@cr
    \MH_let:NwN \math@cr@@\MT_mult_mathcr_atat:w
    \MH_let:NwN \shoveleft\MT_shoveleft:wn
    \MH_let:NwN \shoveright\MT_shoveright:wn
    \spread@equation
    \MH_set_boolean_F:n {mult_firstline}
    \MT_measure_mult:n {#1}
    \MH_if_dim:w \l_MT_multwidth_dim<\l_MT_multline_measure_fdim
      \MH_setlength:dn \l_MT_multwidth_dim{\l_MT_multline_measure_fdim}
    \fi
    \MH_set_boolean_T:n {mult_firstline}
    \MH_if_num:w \l_MT_multline_lastline_fint=\@ne
      \MH_let:NwN \math@cr@@ \MT_mult_firstandlast_mathcr:w
    \MH_fi:
    \ialign\bgroup
      \hfil\strut@$\m@th\displaystyle{}##
      \luamml_flag_save:nNn {} \displaystyle {mtd}
      $
      \__luamml_amsmath_add_last_to_row:
      \hfil
      \crcr
      \hfilneg
      #1
}
\ExplSyntaxOff\makeatother
\usepackage{unicode-math}

\begin{document}

%% issue #1 - misaligned \Bigg\vert when tagging is in effect
\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}

%% issue #2 - multlined and tagging don't play together
\begin{align}
S^i & =  \int_{\Gamma^h_{\mkern-4mu s}} \frac{\partial \theta}{\partial n_s} \, dl_s \\
    &   
    \begin{multlined}
    	=\int_{\Gamma^h_{\mkern-4mu s}} \frac{a(s)}{2}\, dl_s + \int_{\Gamma^h_{\mkern-4mu s}} \int_{\mathcal{C}_\xi}a(\xi) \frac{\partial E(\xi|s)}{\partial n_s} \, dl_\xi dl_s 
	\\ +\int_{\Gamma^h}\lim_{x\to s^-} \frac{\partial}{\partial n_x}\int_{\Gamma^a} \mkern-3mu b(\xi) \frac{\partial E(x|\xi)}{\partial n_\xi} \,dl_\xi dl_s 
    \end{multlined}
\end{align}

\end{document}

@FrankMittelbach
Copy link
Member

@zauguin not sure there is still something open/todo. If not then this should get closed

@FrankMittelbach FrankMittelbach changed the title lualatex-dev with tagging produces errors mathtools: lualatex-dev with tagging produces errors Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants