2

I use only lualatex, but I believe this is a general *.tex question:

Compiling from command line (Linux, probably any system), the Terminal response concludes with something like this:

507 words of node memory still in use:
...
...
Output written on xxx.pdf (7 pages, 63101 bytes).
Transcript written on xxx.log.

I would like to place a message following that, just above where the Terminal returns to command prompt. Is this possible?

It does not help to use package atveryend. If I write \AtVeryVeryEnd{\typeout{DONE!}} it appears above the concluding message shown above.

Why I want to do this: I have a custom document class that analyzes the user settings and font metrics, and provides important information. This, I know how to do. But the information is always displayed above the concluding TeX message, where a user might ignore it. The users are not programmers, so they have no use for the TeX info regarding memory, etc.

I cannot use shell escape.

rallg
  • 2,379

1 Answers1

4

You can't do that in classic tex, but luatex gives you Lua access.

Terminal output ending in "hello world"

This is LuaHBTeX, Version 1.17.0 (TeX Live 2023) 
 restricted system commands enabled.
(./ee276.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-10-23>
 (/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./ee276.aux) (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./ee276.aux))</usr/local/texlive/2023/texmf-dist/fonts/opentype/public/lm/lmro
man10-regular.otf>

hello world

From

\documentclass{article}

\directlua{ luatexbase.add_to_callback('stop_run', function () texio.write("\string\n\string\n hello world\string\n") end, "final message" ) } \begin{document}

aaa

\end{document}

As seen above, stop_run callback replaces the usual printing of statistics. If you replace stop_run by wrapup_run then it comes after the usual statistics are printed

The documentation of this callback is, in full

This callback is called after the pdf and log files are closed. Use it at your own risk.

But I think it's safe enough here

$ lualatex ee276
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023) 
 restricted system commands enabled.
(./ee276.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-10-23>
 (/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./ee276.aux) (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./ee276.aux))
 406 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 2:22,3:4,4:1,5:22,6:2,7:34,9:18
</usr/local/texlive/2023/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on ee276.pdf (1 page, 2613 bytes).
Transcript written on ee276.log.

hello world

David Carlisle
  • 757,742
  • Yay! That is what I need! I added \string\n after the text, so that the terminal prompt is returned to the left. – rallg Oct 27 '23 at 19:17
  • For the benefit of others who find this thread: If the message is more than one word, do something like this: texio.write("\string\n\string\nHello,\space World.\string\n") – rallg Oct 27 '23 at 19:26
  • On my system, just typing a space does not necessarily work. The words join (might make a difference if there is punctuation or not). I needed \space before the typed space. – rallg Oct 27 '23 at 19:30
  • 1
    @rallg oh sure that's just normal "space after a command name" and you have \nHello so the space is dropped after it. but not after a comma or a word like Hello so you could use a space after the \n: so \string\n Hello World – David Carlisle Oct 27 '23 at 19:32
  • 1
    @rallg second example using wrapup_run added – David Carlisle Oct 27 '23 at 19:56