lualatex / luamplib

generic TeX package - including MetaPost code in LuaTeX documents
http://ctan.org/pkg/luamplib
16 stars 11 forks source link

show and showlog #91

Closed shreevatsa closed 3 years ago

shreevatsa commented 3 years ago

Thanks for luamplib: I'm trying to use MetaPost, and this seems to make compilation easier (no separate mpost and loop of mptopdf steps, plus directly going .tex.pdf integrates better with TeX editors like TeXShop). But I ran into a couple of (related) problems. Consider this document:

% !TEX TS-program = lualatex
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
% \directlua{luamplib.showlog = true;}
\begin{mplibcode}
beginfig(1);
u = 42bp;
show u;
draw (0, 0) -- (u, u);
endfig;
\end{mplibcode}
\end{document}

The file compiles successfully, but the output of the show u; command shows up only in the log file, and not at the terminal as I would like. If I manually compile the equivalent file with mpost:

beginfig(1);
u = 42bp;
show u;
draw (0, 0) -- (u, u);
endfig;
end.

then I do see ">> 42" at the terminal. Maybe this is expected, or maybe the luamplib manual means otherwise where it says:

v2.6.1: now luamplib does not disregard show command, even when luamplib.showlog is false.

Which brings me to the second issue: If I include the \directlua{luamplib.showlog = true;} above (make it no longer commented out), then lualatex silently (as far as the terminal output is concerned) produces an empty image. The log file contains something like:

Module luamplib Info: 
(luamplib)            This is MetaPost, Version 2.00  29 DEC 2020 09:57
(luamplib)            
(luamplib)            
(luamplib)            (/usr/local/texlive/2020/texmf-dist/metapost/base/plain.mp
(luamplib)            Preloading the plain mem file, version 1.005)
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            
(luamplib)            (Please type a command or say `end')
(luamplib)            (Please type a command or say `end')
(luamplib)            
(luamplib)            
(luamplib)            >> 42
(luamplib)            
(luamplib)            [1]
(luamplib)            (Please type a command or say `end')
(luamplib)            (Please type a command or say `end')
(luamplib)            on input line 12

This is on macOS 10.15.7, and I see it with both TeX Live (This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)) and MiKTeX (This is LuaHBTeX, Version 1.12.0 (MiKTeX 20.12)).

Thanks,

shreevatsa commented 3 years ago

An earlier issue https://github.com/lualatex/luamplib/issues/43 looks related though I guess that issue (from 2014) is from before the v2.6.1 mentioned in the manual above. Also there it mentions "console and log file" both. If I understand correctly, this may be a regression.

dohyunkim commented 3 years ago

Thanks for the report. Now show command prints mplib log to the console, and the bug related to luamplib.showlog has been fixed. A new version will be released soon.

shreevatsa commented 3 years ago

Just got the update today on MiKTeX, and after the update of luamplib to 2.20.6, now the output of both show and message shows up in the terminal, thank you! This issue can be closed now.