[lltx] lualatex-math cannot find unpack function

Philipp Gesang Philipp.Gesang at alumni.uni-heidelberg.de
Sat Aug 3 21:21:49 CEST 2013


···<date: 2013-08-03, Saturday>···<from: Wolfgang Jeltsch>···

> Am Samstag, den 03.08.2013, 17:13 +0200 schrieb Ulrike Fischer:
> > Am Sat, 3 Aug 2013 16:40:20 +0200 schrieb Martin Schröder:
> > 
> > > 2013/8/3 Wolfgang Jeltsch <g9ks157k at acme.softbase.org>:
> > >> if I import both amsmath and lualatex-math, I get the following error
> > >> message when LuaLaTeX tries to process \begin{document}:
> > >>
> > >> ! LuaTeX error
> > >> .../texmf-dist/tex/lualatex/lualatex-math/lualatex-math.lua:46:
> > >> attempt to call upvalue 'unpack' (a nil value)
> > >> stack traceback:
> > >>         .../texmf-dist/tex/lualatex/lualatex-math/lualatex-math.lua:46:
> > >>         in function 'print_class_fam_slot'
> > >>         [string "\directlua "]:1: in main chunk.
> > >> \__lltxmath_set_mathchar:NN ...\int_eval:n {`#2})}
> > >>                                                   \scan_stop:
> > >>
> > >> What is the reason for this?
> > > 
> > > Which version of LuaTeX do you use?
> > 
> > I can reproduce the problem on TeXLive 2013 with 
> > This is LuaTeX, Version beta-0.76.0-2013061707
> 
> This is also the version I’m using, except that the last digit is 8
> instead of 7.
> 
> > and this example:
> > 
> > \documentclass[]{article}
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > \usepackage{amsmath}
> > \usepackage{lualatex-math}
> > \begin{document}
> > blub
> > \end{document}
> 
> Yes, this is pretty much my test document that triggers this error.
> 
> I think I have found the source of the problem. In Lua 5.1, unpack is a
> global function, while in Lua 5.2, it is a field of the global variable
> table. To ensure compatibility with both Lua versions, some Lua files
> (lualibs-basic-merged.lua, lualibs-lua.lua, and luaotfload-merged.lua)
> contain the following code:
> 
>     if not table.unpack then
>       table.unpack=_G.unpack
>     elseif not unpack then
>       _G.unpack=table.unpack

Packages shouldn’t write to _G.

>     end
> 
> By adding this code to lualatex-math.lua at an appropriate place, the
> issue with lualatex-math and amsmath was fixed.
> 
> I will send a patch to Philipp Stephani.

Fyi I’ve already sent him a pull request.

Best,
Philipp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://tug.org/pipermail/lualatex-dev/attachments/20130803/2f596436/attachment.bin>


More information about the lualatex-dev mailing list