[luatex] Question about tex.setmath(..., ..., ...) [hope this is the right list]
Graham Douglas
graham.douglas at readytext.co.uk
Mon Jul 18 23:49:46 CEST 2016
Hi All
I'm exploring LuaTeX's OpenType maths capabilities and have a question
about tex.setmath(...,...,...). A minimal working example is below.
Note, it's my own custom (La)TeX setup, not a standard distribution,
which I setup a few days ago using the latest versions of everything
from CTAN. It all works fine, maths typesetting in Cambria Math looks
great apart from some spacing tweaks I want to make.
luaotfload: 2016/06/16 v2.7
unicode-math 2015/09/24 v0.8c
I'm on Windows 7 using LuaTeX, Version 0.96.0 (TeX Live 2016) which I
compiled from source code.
My question is:
I can't get tex.setmath(...,...,...) to work and am stumped why---maybe
I misunderstand its use. In the example below, if I use
\Umathfractionnumup\displaystyle=2pt
\Umathfractionnumvgap\displaystyle=2.5bp
in the maths, it works fine and adjusts the spacing nicely (see second
equation in PNG file). However, if I try to apply these settings
globally via:
\directlua{
tex.setmath("global", "fractionnumup", "text", 131072)
tex.setmath("global", "fractionnumvgap", "text", 163840)
}
then the spacing is not changed. See first equation in the attached PNG
file (which is the output of the minimal example).
What am I doing wrong, or what have I failed to understand? (Note, also
tested the above with a recent build of experimental version, 0.97, but
same result)
Many thanks for any help.
Cheers
Graham
========================
Minimal working LaTeX 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}
% This works perfectly:
\[
\Umathfractionnumup\displaystyle=2pt\Umathfractionnumvgap\displaystyle=2.5bp
\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.
\]
% This does not, even if I put \directlua{} into the math code to ensure
math mode
\directlua{
tex.setmath("global", "fractionnumup", "text", 131072)
tex.setmath("global", "fractionnumvgap", "text", 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.
\]
\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathsquestion.png
Type: image/png
Size: 26859 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20160718/76bb94c6/attachment-0001.png>
More information about the luatex
mailing list