1

Everybody loves the \show tex primitive.

Sadly it so happens that whenever I \show something the execution/compilation which I call using pdftex -halt-on-error also stops, which was quite supprising to me having not perceived \show primitive to be an error. Can somebody please tell me to stop \show behaving like an error? Why was it behaving like an error in the first place?

the output after a show was used like this

\def\a{A}
\show\a

is the following

>\a=macro:
->A.
l.2 \show \a

!  ==> Fatal error occurred, no output PDF file produced!

Besides my testing, also this answer here tells about \shows behavioral problems it states

TeX will prompt the user for interaction in the event of an error ('error' includes \show or similar) (The user may of course alter the run mode within TeX using the related primitives.)

This seems to motivate this question further, as if I understand right there is a way to alter the run mode within TeX. I think that would be the way to stop \show being an error, but how?

  • @egreg The backgrounding issue is indeed the same to both questions, yet I think that this question is more directly asking the question, that is the behavior of \show while the other question was asking a more specific case and that is why I didn't spot it. If I was to internet search the question I would most likely find this question first, after all i do not even use texmaker or an ide – humanityANDpeace Aug 15 '16 at 13:16
4

You could use

\scrollmode\show\foo

Which will stop \show stopping the run in normal tex processing (apparently the -halt-on-error commandline forces \show to stop even in \scrollmode) but you always have the option of not using that option...

bit simpler and more flexible if you do not want it to stop is to use

\typeout{\meaning\foo}

as then you can adjust the text to requiremtnts

\typeout{the meaning of \string\foo\space is \meaning\foo}
| improve this answer | |
  • 1
    Am I rightly thinking that it would best be \message{\meaning\foo} or similar for plain tex? – humanityANDpeace Aug 15 '16 at 12:58
  • 1
    @humanityANDpeace \message or \wlog or \write16 or any other similar thing yes, or \def\typeout{\write16} or ... – David Carlisle Aug 15 '16 at 13:00
  • Is it just with my version of pdftex or does \scrollmode\show\foo not yield the desired effect, i.e. still yields a fatal error? – humanityANDpeace Aug 15 '16 at 13:01
  • @humanityANDpeace hmm I'll adjust answer \scrollmode stops \show stopping but apparently -halt-on-error trumps that and makes it stop again, but why do that (I don't think I've ever used that option in 30 years of tex use) – David Carlisle Aug 15 '16 at 13:04
  • Being that most errors subsequent to the first error might be rather consequential -halt-on-error option helps me to abort early and reduces the output and furthermore I can catch the exit status in the bash shell and script automatic handling regarding the result of pdftex, it can be imho a good , at least if you do not use a ide – humanityANDpeace Aug 15 '16 at 13:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.