# Print a message at the END of the log file

I there a way to print messages to the log file so that they appear in the last few line of the log file?

Here is a MWE for my first attempt at doing this:

\documentclass{amsart}
\AtEndDocument{\typeout{*****************************************^^J
Here is my nice message^^J
*****************************************^^J}}
\begin{document}
Some important stuff.
\end{document}


At first sight this appears to do what I want because in this case the end of the logfile looks like:

...
***********************************************************************
Here is my nice message
***********************************************************************

[1{/usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./MWE.aux) )</usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/c
mr10.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmr
7.pfb>
Output written on MWE.pdf (1 page, 20364 bytes).
Transcript written on MWE.log.


Unfortunately, this is deceptive because the guff between my message and the Output written... line is quite short here. In a real use-case the end of the log file looks more like:

...
*****************************************
Here is my nice message
*****************************************

[7] (./realexample.aux) )
(see the transcript file for additional information){/usr/local/texlive/2014/te
xmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/local/texlive/2014/texmf-dist/fonts/
enc/dvips/tex-gyre/q-ec.enc}</usr/local/texlive/2014/texmf-dist/fonts/type1/pub
lic/tex-gyre/qhvr.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/public/ne
wtx/rntxmi.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/public/txfonts/r
txb.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/public/txfonts/rtxmi.pf
b></usr/local/texlive/2014/texmf-dist/fonts/type1/public/txfonts/rtxr.pfb></usr
/local/texlive/2014/texmf-dist/fonts/type1/public/txfonts/rtxsc.pfb></usr/local
/texlive/2014/texmf-dist/fonts/type1/public/newtx/txex-bar.pfb></usr/local/texl
ive/2014/texmf-dist/fonts/type1/public/txfonts/txex.pfb></usr/local/texlive/201
4/texmf-dist/fonts/type1/public/txfonts/txsy.pfb></usr/local/texlive/2014/texmf
-dist/fonts/type1/public/txfonts/txsyb.pfb></usr/local/texlive/2014/texmf-dist/
fonts/type1/public/txfonts/txsyc.pfb></usr/local/texlive/2014/texmf-dist/fonts/
type1/urw/times/utmb8a.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/urw/
times/utmr8a.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/urw/times/utmr
i8a.pfb>
Output written on realexample.pdf (7 pages, 124830 bytes).
SyncTeX written on realexample.synctex.gz.
Transcript written on realexample.log.


That is, in real-life there is a lot of space between my message and the end of the log file.

It turns out that Heiko Oberdiek has written the atveryend package that provides various commands like: \AtVeryEndDocument, AtEndAfterFileList, \AtVeryVeryEnd. Unfortunately, all of these commands give exactly the same output in the log file as using \AtEndDocument. Similarly, the etoolbox command \AfterEndDocument doesn't help either...

Does anyone know of a way to do this or if this is impossible? Given Heiko's package I suspect this can't be done.

Finally, perhaps I should say that the reason that I want to do this is to remind myself (and others) of the list of options to an undocumented in-house class...

-

You have already found the latest possibilities for writing into the .log file:

• \AtVeryVeryEnd of package atveryend
• \AfterEndDocument of package etoolbox

Both hook into \end{document} to put the hook right before the final \@@end (= the primitive \end). \AtEndDocument is too early, because the final \clearpage and reading of the .aux file with its rerun warnings are following.

But AFAIK there is no way inside TeX code to print something after the fonts, which are output by pdfTeX, when it finishes the output of the .pdf file.

A clumsy workaround would be to write the final message to a file, e.g. \jobname.message and to use a script, which first runs pdflatex and then appends the output of the file \jobname.message to the .log file.

-
Thanks for confirming this Heiko! I thought that was probably the case but hoped otherwise:) – Andrew Aug 21 '14 at 13:31