\setmathfont command requires 2 minutes to compile with lualatex

97 Views Asked by At

This code takes 10 seconds to compile to a pdf. If I enable in the code the additional lines it takes 2 minutes to compile for the 5 lines. And this happens everytime.

Why does it take so long, and how can I prevent it?

The system is texlive on windows with latest packages:

This is LuaHBTeX, Version 1.15.0 (TeX Live 2022)  (format=lualatex 2022.12.10)  17 DEC 2022 20:53
 restricted system commands enabled.
LaTeX2e <2022-11-01> patch level 1
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support

This is the code

% !TeX encoding=utf8
% !TeX program = lualatex

\documentclass{article}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{tabularray}
\usepackage{xcolor}

\begin{document}
\newcommand{\fontstring}{Sphinx of black quartz, judge my vow.}
\newcommand{\mathstring}{$f(u,v) = \iiint \left[u\nabla^{2}v+\left(\nabla  u,\nabla  v\right)\right]\mathrm{d}^{3}V$}

\colorlet{tablerowcolor}{gray!10}
\colorlet{tablesubheadcolor}{azure3!30}


{ % start a group 
    \small\renewcommand{\arraystretch}{1.4}\sffamily
    % the table
    \begin{longtblr}[
        caption = {Font examples},
        label = {tab:doc:Font:Gallery}]
        {
            colspec = {X[1,l]>{\ttfamily}X[2,l]},
            width = 1.0\textwidth,
            row{odd} = {bg=tablerowcolor},
            row{1}   = {bg=azure3, fg=white, font=\sffamily\upshape},
            rowhead = 1,
            rowfoot = 0,
        }       
        \hline % Table Header
        Font & Example \\ 
        \hline %        
        %
        \SetCell[c=2]{l,bg=tablesubheadcolor} Latin Modern Family \\
        Latin Modern Roman   & \setmainfont{Latin Modern Roman} \rmfamily \fontstring \\
        Latin Modern Sans    & \setsansfont{Latin Modern Sans}  \sffamily\fontstring \\
        Latin Modern Mono    & \setmonofont{Latin Modern Mono}  \ttfamily \fontstring \\
        %
        \SetCell[c=2]{l,bg=tablesubheadcolor} Math Fonts \\
        %
        Latin Modern Math       & \setmathfont{Latin Modern Math}       \rmfamily \mathstring \\
%       TeX Gyre Termes Math    & \setmathfont{TeX Gyre Termes Math}    \rmfamily \mathstring \\
%       TeX Gyre Pagella Math   & \setmathfont{TeX Gyre Pagella Math}   \rmfamily \mathstring \\
%       Charter - math version  & \setmathfont{XCharter-Math.otf}   \rmfamily \mathstring \\
%       Garamond math version   & \setmathfont{Garamond-Math}       \rmfamily \mathstring \\
%       Cambria Math            & \setmathfont{Cambria Math}        \rmfamily \mathstring \\
        %       %
        \hline
        %
    \end{longtblr}  
} % close the group
\end{document}
0

There are 0 best solutions below