<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 8 May 2023 at 13:56, Martin Münch <<a href="mailto:Martin.Muench@uni-bonn.de">Martin.Muench@uni-bonn.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When compiling the code<br>
<br>
\documentclass{minimal}<br>
\newwrite\teststream<br>
\immediate\openout\teststream="teststream"<br>
%\showstream=\teststream<br>
\def\example{\message{This}\message{is}\message{a}\message{test.}}<br>
\show\example<br>
\AddToHook{begindocument}[foobar]{\message{Hi!}}<br>
\ShowHook{begindocument}<br>
\begin{document}<br>
\end{document}<br>
<br>
the log-file contains:<br>
<br>
> \example=macro:<br>
->\message {This}\message {is}\message {a}\message {test.}.<br>
l.6 \show\example<br>
<br>
?<br>
<br>
-> The hook 'begindocument':<br>
> Code chunks:<br>
> foobar -> \message {Hi!}<br>
> Document-level (top-level) code (executed last):<br>
> ---<br>
> Extra code for next invocation:<br>
> ---<br>
> Rules:<br>
> ---<br>
> Execution order:<br>
> foobar.<br>
<recently read> }<br>
<br>
l.8 \ShowHook{begindocument}<br>
<br>
?<br>
<br>
and the `teststream.tex` file is empty.<br>
<br>
When the `%` before `\showstream=\teststream` is removed and the code is <br>
compiled, in the log-file (and on screen) it is<br>
<br>
-> The hook 'begindocument':<br>
> Code chunks:<br>
> foobar -> \message {Hi!}<br>
> Document-level (top-level) code (executed last):<br>
> ---<br>
> Extra code for next invocation:<br>
> ---<br>
> Rules:<br>
> ---<br>
> Execution order:<br>
<br>
and the `teststream.tex` contains:<br>
<br>
> \example=macro:<br>
->\message {This}\message {is}\message {a}\message {test.}<br>
<br>
> foobar<br>
<br>
i.e. the output from `\show` is moved from log and screen to <br>
`teststream.tex` (as expected), but `\ShowHook` only removes<br>
<br>
> foobar.<br>
<recently read> }<br>
<br>
l.8 \ShowHook{begindocument}<br>
<br>
?<br>
from screen and log and except `> foobar` neither writes it into <br>
`teststream.tex`.<br>
<br>
My expectation was: Either<br>
- showstream also working for `\ShowHook`: Everything from `\ShowHook` <br>
is removed from screen and log and printed in `teststream.tex`<br>
or<br>
- showstream not working for `\ShowHook`: Nothing from `\ShowHook` is <br>
removed from screen and log and printed in `teststream.tex`.<br>
<br>
Is my expectation wrong or is the behaviour of `showstream` strange?<br></blockquote><div><br></div><div><br></div><div>\ShowHook is a mixture of (essentially) \wlog and \show to output some latex</div><div>information then finally give the \show interaction,</div><div><br></div><div>\showstream (which I have never seen used before:-) only affects the parts</div><div>using \show, so the message preamble using \write still goes to the log.</div><div><br></div><div>Latex could (I suppose) check every time if
\showstream is an open stream</div><div>and if so write to there, or perhaps always write to \showstream and rely</div><div>on tex's behaviour of writing to the log for unopened stream numbers.</div><div><br></div><div>You could make an enhancement request at github</div><div><br></div><div>David</div><div><br></div><div><br></div><div><br></div></div></div>