[luatex] Problem with callback // LaTeX

David Carlisle d.p.carlisle at gmail.com
Tue Oct 22 14:30:24 CEST 2019


looks like a latex bug sorry, the callback is classified as

%   \item[simple] is for functions that don't return anything: they are called
%     in order, all with the same argument;

so the latex callback handler drops your return value.

On Tue, 22 Oct 2019 at 13:24, Patrick Gundlach <patrick at gundla.ch> wrote:
>
> Hello all,
>
> this is probably more a LuaLaTeX question. I experience problems with the page_objnum_provider callback (PDF won't open in Adobe Acrobat) and to make a minimal example, I tried this LuaLaTeX snippet:
>
> ------------------------------------------
> \documentclass{article}
> \usepackage{luacode}
> \begin{document}
>
> \begin{luacode}
>   function shuffle(objnum) return objnum end
>   luatexbase.add_to_callback("page_objnum_provider",shuffle,"my shuffle")
> \end{luacode}
>
> text text
> \clearpage
> text text
> \clearpage
> text text
> \end{document}
> ------------------------------------------
>
>
> Now I get the following messages from the command line:
>
>
> callback should return a number, not: nil
>
>
> But I do return a number (the original object number).
>
> Is there something I did wrong?
>
> Patrick
>
> The terminal output:
>
> $ lualatex test
> This is LuaTeX, Version 1.10.0 (TeX Live 2019)
>  restricted system commands enabled.
> (./test.tex
> LaTeX2e <2019-10-01> patch level 1
>
> luaotfload | main : initialization completed in 0.155 seconds
> (/opt/texlive2019/texmf-dist/tex/latex/base/article.cls
> Document Class: article 2019/08/27 v1.4j Standard LaTeX document class
> (/opt/texlive2019/texmf-dist/tex/latex/base/size10.clo))
> (/opt/texlive2019/texmf-dist/tex/lualatex/luacode/luacode.sty
> (/opt/texlive2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
> (/opt/texlive2019/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
> (/opt/texlive2019/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)))
> (./test.aux) [1{/opt/texlive2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
>  [2] [3] (./test.aux))
>  377 words of node memory still in use:
>    2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 44 glue_spec
> , 4 attribute_list, 1 write nodes
>    avail lists: 2:15,3:2,4:1,5:21,6:1,7:22,9:7
> </opt/texlive2019/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf>callback should return a number, not: nil
> callback should return a number, not: nil
> callback should return a number, not: nil
>
> Output written on test.pdf (3 pages, 3577 bytes).
> Transcript written on test.log.
>
>


More information about the luatex mailing list