5

Is it possible that LuaTeX is incomplete with respect to things that are referenced for example in the LuaTeX Reference?

My engine is: LuaTeX, Version 0.95.0 (TeX Live 2016) (format=lualatex 2017.1.20)

What does not seem to work are at least the following:

\directlua{tex.sprint(number.dimenfactors["mm"])}
\directlua{tex.sprint(number.tocentimeters(100000))}
\directlua{tex.sprint(1,'pt')}

The first two commands I found at http://wiki.contextgarden.net/Dimensions, and the last in the manual at http://www.luatex.org/svn/trunk/manual/luatex.pdf

EDIT: MWE

\documentclass{article}
\begin{document}
number.dimenfactors: \directlua{tex.sprint(number.dimenfactors["mm"])}
number.tocentimeters: \directlua{tex.sprint(number.tocentimeters(100000))}
print two objects: \directlua{tex.sprint(1,'pt')}
\end{document}

The result is: Output from MWE above.

The first two lines do not create the desired output, but cause these two (unfortunately not very instructive) errors in the log file:

[\directlua]:1: attempt to index global 'number' (a nil value)
stack traceback:
    [\directlua]:1: in main chunk.
l.3 ...ectlua{tex.sprint(number.dimenfactors["mm"])}

The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.

[\directlua]:1: attempt to index global 'number' (a nil value)
stack traceback:
    [\directlua]:1: in main chunk.
l.4 ...lua{tex.sprint(number.tocentimeters(100000))}

The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.

The third command just outputs the string in the second argument, but not the number in the first.

  • 1
    Wecome to TeX SX! Try updating: present version is 1.0. – Bernard Feb 2 '17 at 20:49
  • 1
    @Bernard - There's currently an admittedly odd discrepancy in versions of LuaTeX across the two main TeX distributions: MikTeX features version 1.0, but TeXLive still features version 0.95. – Mico Feb 2 '17 at 21:46
  • @Mico: I had no idea of that. It's been quite a few months MiKTeX has version 1.0! – Bernard Feb 2 '17 at 21:55
  • 1
    What do mean by "seem not to work"? I get no error with texlive and miktex and the output is identical when I add the commands to a minimal document. – Ulrike Fischer Feb 2 '17 at 22:05
  • 2
    BTW, your last error is easily explainable: you have not read the documentation carefully; the argument n is not something that is printed by tex.sprint: the documentation says: "The optional parameter can be used to print the strings using the catcode regime defined by \catcodetable n. […] Otherwise, if n is not a valid catcode table, then it is ignored, and the currently active catcode regime is used instead." – ShreevatsaR Feb 3 '17 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.