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

Shachar Itzhaky corwin.amber at gmail.com
Thu Jul 21 23:12:15 CEST 2016


As an aside: is it written somewhere in the manual that all dimensions passed to tex.setmath are in sp?
(The manual is not easily searchable and I have yet to read it cover-to-cover.)
The section about setmath says only
"The value is either a number (representing a dimension or number) or a glue spec node repre- senting a muskip for ordordspacing and similar spacing parameters."
The discussion of dimension registers in Section 9.3.4 does mention sp. I must admit that as a newbie, I did not even know that scaled points exist until I reverse-engineed the values in this post and googled "latex 65536".

> On Jul 20, 2016, at 09:05, Graham Douglas <graham.douglas at readytext.co.uk> wrote:
> 
> <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}
> 
> 
> <mathlist.png>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20160721/ea25eceb/attachment.html>


More information about the luatex mailing list