0

For debugging purposes, I'd like to be able to stop or pause my code compilation at will by using apposite commands, both inside and outside the preamble of my document. Do such commands exist in (La)Tex? I use MikTex and WinEdt. Thanks, Jorge.

dontpanic
  • 809
  • 2
    there are commands like \show that will pause the compilation and display the requested information. these are listed in chapters 35 and 35 of "tex by topic" (texdoc texbytopic). this may be what you're asking for, since they're intended for debugging. – barbara beeton Apr 26 '18 at 16:12
  • @barbarabeeton chapters 35 and 35 ? – albert Apr 26 '18 at 16:32
  • @albert -- er, 34 and 35. (someday i'll learn to type without errors.) – barbara beeton Apr 26 '18 at 16:46

1 Answers1

1

You can stop the processing with \errormessage or \show or \showthe and in the default interactive mode resume the processing by just typing return top the ? prompt. Or, specifically for pausing TeX has a primitive called \pausing, which if set non zero causes TeX to pause after each line:

\documentclass{article}
\pausing=1
\begin{document}

\section{aaa}
zzzzz
ZZZZZ

\end{document}

produces a terminal session of

LaTeX2e <2018-04-01> patch level 4
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
\begin{document}=>
(./aa502.aux
\relax=>

\@writefile{toc}{\contentsline {section}{\numberline {1}aaa}{1}}=>
)
=>

\section{aaa}=>

zzzzz=>

ZZZZZ=>

=>

\end{document}=>
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./aa502.aux
\relax=>

\@writefile{toc}{\contentsline {section}{\numberline {1}aaa}{1}}=>
) )</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pf
b></usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on aa502.pdf (1 page, 15993 bytes).
Transcript written on aa502.log.

where TeX stopped at each => prompt hitting return makes it carry on but you can insert new text or use \show to test the values of commands etc.

David Carlisle
  • 757,742
  • Thank you all for your replies. \show seems to do the trick. Silly follow-up: used without arguments it still outputs "> \par=\par.". Is there a way to suppress this and just use it as a debugging pause command (i.e. no output whatsoever)?. – dontpanic Apr 26 '18 at 18:54
  • @dontpanic that is not without arguments that has taken (and consumed) the blank line following and shown it as \par. – David Carlisle Apr 26 '18 at 18:59
  • Thank you for the explanation, David. Indeed, I just had a line "\show" followed by two blank lines. I guess its good enough this way! (if there is a way to suppress this behavior, please let me know). – dontpanic Apr 26 '18 at 20:10
  • @dontpanic if you want it to stop without consuming any of your real document \show\show is a possibility, it will stop with \show=\show – David Carlisle Apr 26 '18 at 20:11