[luatex] Question about tex.setmath(..., ..., ...) [hope this is the right list]

Graham Douglas graham.douglas at readytext.co.uk
Wed Jul 20 15:05:19 CEST 2016


<snip>
> Dear Akira
>
> Many thanks for your help and time.
>
> I'll compile version 0.98, re-run all my tests and write back to the list.
>
> My best wishes
>
> Graham

Dear Akira

I quickly installed your distribution of  Version 0.98.0 (TeX Live
2016/W32TeX) and ran the example below.
I now see results similar to you, PNG attached. Possibly the conclusion
is that code like this:

\directlua{
tex.setmath("global", "fractionnumup", "display", 131072)
tex.setmath("global", "fractionnumvgap", "display", 163840)
}

has to be called at least once in math mode for the "global" value to
work. Calling it outside math mode has no effect.
Whether it can, or should, be possible to set these values outside math
mode is a question for those with far
greater expertise than I possess.

Thank you for your help+suggestions.

Best wishes
Graham

%===============================================
% Minimal example
%==============================================
\directlua{
tex.outputmode = 1
}
\edef\pdfminorversion{\pdfvariable minorversion}
\pdfminorversion=6
\documentclass[a4paper,10pt,twoside]{book}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage[math-style=TeX]{unicode-math}
\begin{document}
\def\IHb#1{{\hskip-#1bp\relax}} %kludge to fix spacing around limits on
integrals (to explore cause!)
\setmainfont{Constantia}
\setmathfont{Cambria Math}

\noindent Example 1: Try to globally set math params in
\verb!\directlua{}! but outside math mode.\par
\noindent Result: Spacing not changed.

\directlua{
tex.setmath("global", "fractionnumup", "display", 131072)
tex.setmath("global", "fractionnumvgap", "display", 163840)
}
\[    \int_{\IHb{3}a}^{\IHb{1.5}b}u\frac{d^2v}{dx^2}\,dx
    =\left.u\frac{dv}{dx}\right|_a^b
    -\int_{\IHb{3}a}^{\IHb{1.5}b}\frac{du}{dx}\frac{dv}{dx}\,dx.
\]

\noindent Example 2: Use \verb!\Umath...! commands inside math.\par
\noindent Result: Works perfectly.

\[
\Umathfractionnumup\displaystyle=2pt\Umathfractionnumvgap\displaystyle=2.5pt
    \int_{\IHb{3}a}^{\IHb{1.5}b}u\frac{d^2v}{dx^2}\,dx
    =\left.u\frac{dv}{dx}\right|_a^b
    -\int_{\IHb{3}a}^{\IHb{1.5}b}\frac{du}{dx}\frac{dv}{dx}\,dx.
\]

\noindent Example 3: Now re-set math but again do not use
\verb!\directlua{}! or \verb!\Umath...! commands.\par
\noindent Result: Spacing not changed.

\[    \int_{\IHb{3}a}^{\IHb{1.5}b}u\frac{d^2v}{dx^2}\,dx
    =\left.u\frac{dv}{dx}\right|_a^b
    -\int_{\IHb{3}a}^{\IHb{1.5}b}\frac{du}{dx}\frac{dv}{dx}\,dx.
\]

\noindent Example 4: Change spacing by putting \verb!\directlua{}! code
into math expression\par
\noindent Result: Works perfectly.
\[
\directlua{
tex.setmath("global", "fractionnumup", "display", 131072)
tex.setmath("global", "fractionnumvgap", "display", 163840)
}
    \int_{\IHb{3}a}^{\IHb{1.5}b}u\frac{d^2v}{dx^2}\,dx
    =\left.u\frac{dv}{dx}\right|_a^b
    -\int_{\IHb{3}a}^{\IHb{1.5}b}\frac{du}{dx}\frac{dv}{dx}\,dx.
\]

\noindent Example 5: Once again, do not use \verb!\directlua{}! or
\verb!\Umath...! \par
\noindent Result: Works perfectly.
\[    \int_{\IHb{3}a}^{\IHb{1.5}b}u\frac{d^2v}{dx^2}\,dx
    =\left.u\frac{dv}{dx}\right|_a^b
    -\int_{\IHb{3}a}^{\IHb{1.5}b}\frac{du}{dx}\frac{dv}{dx}\,dx.
\]

\end{document}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathlist.png
Type: image/png
Size: 127222 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20160720/48bfda3e/attachment-0001.png>


More information about the luatex mailing list