2

In the following example, I don't know how to exit from the build process:

? ! Interruption.
^Cl.1917347403 
             
? ! Interruption.
^Cl.1931472264 
             
? x
! Interruption.
^Cl.2066204236 
             
? X
^C! Interruption.
l.-1934605930 
              
? Exit 
! Interruption.
^Cl.-1836968160 
              
? 

I've tried SIGINT, eof, x, X, exit, but nothing works. I have to SIGSTOP and kill the process manually.

What am I doing wrong?

5
  • As I remember from the time when I used latexmk, you just use control+C to send an abort signal. Jan 24, 2022 at 14:37
  • Unfortunately the SIGINT didn't solve the issue
    – nowox
    Jan 24, 2022 at 14:41
  • Might be useful to know what you used to kill latexmk with (the latex code) and which OS you are on.
    – daleif
    Jan 24, 2022 at 15:02
  • @daleif linux ubuntu
    – nowox
    Jan 24, 2022 at 15:03
  • And the code that causes latex to behave like this?
    – daleif
    Jan 24, 2022 at 17:01

1 Answer 1

1

I ran latexmk -shell-escape to see if the option was --shell-escape or -shell-escape, and it dropped me into this interpreted build session like you show above. Because I was in a directory with .tex files, it started processing them.

Eventually, I got a message saying to type H for help, and got this response after trying H:

Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
H for help, X to quit.

After much digging around on the internet, and playing around with this mode, this is what I've learned:

You have entered the interactive mode, where *tex will stop at any errors, giving you a chance to correct them. As far as I've found, all of the options aimed at keeping you out of this mode only apply before you get into it. Once in it, you have limited options, short of kill -9 or the like.

  1. use the H command - this command will display more details about the encountered error, suggesting how you might interactively fix it.
  2. use Ctrl-C - this will essentially skip to the next error; you could be at this all day, and then it will start on the next file in your directory.
  3. use Q to run quietly - this will run the rest of the current file quietly; you will have to use it repeatedly to completely exit.
  4. use X to quit - this will quit processing the current file; you will have to use it repeatedly to completely exit.

In a directory with 7 .tex files and 1 .bib file, it takes me entering X<return> four times to finally exit.

There are more things you can do in this interactive mode, and this answer has more details, but if you just want to exit (you didn't mean to get there in the first place, or you're not in a position to use the interactive build, or you would rather use some other tool to fix errors), X is probably your best bet, without resorting to killing it manually. Note that you may have to clean up generated files after.

If you are wanting to avoid getting into this mode, but still wanting to run latexmk from the command line, the ubuntu man page shows a few options:

-f     Force latexmk to continue  document  processing  despite  errors.   Normally,  when
       latexmk  detects that LaTeX or another program has found an error which will not be
       resolved by further processing, no further processing is carried out.

       Note: "Further processing" means the running of other programs or the rerunning  of
       latex  (etc)  that  would  be  done  if  no  errors  had  occurred.  If instead, or
       additionally, you want the latex (etc) program not to pause for user input after an
       error, you should arrange this by an option that is passed to the program, e.g., by
       latexmk's option -interaction=nonstopmode.
-quiet Same as -silent

-silent
       Run  commands  silently,  i.e.,  with options that reduce the amount of diagnostics
       generated.   For  example,  with  the  default   settings,   the   command   "latex
       -interaction=batchmode" is used for latex.

       See also the -logfilewarninglist and -logfilewarninglist- options.

       Also reduce the number of informational messages that latexmk generates.

       To change the options used to make the commands run silently, you need to configure
       latexmk with changed values of its configuration variables, the relevant ones being
       $bibtex_silent_switch,         $biber_silent_switch,         $dvipdf_silent_switch,
       $dvips_silent_switch,    $latex_silent_switch,    $makeindex_silent_switch,     and
       $pdflatex_silent_switch.

There is also an option that will get passed to the underlying *tex engine, discoverable via the showextraoptions option:

-halt-on-error          stop processing at the first error

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .