[ACCEPTED]-Run pdflatex quietly-pdflatex

Accepted answer
Score: 67

Unfortunately (La)TeX doesn't really abide 12 by the rules of stdout and sterr, owing (I assume) to 11 its origins in the early 80s. But there 10 are some switches you can invoke to alter 9 the amount of information being shown.

Execute 8 latex with either the -interaction=nonstopmode or -interaction=batchmode switches for non-halting 7 behaviour even in the case of a syntax error. nonstopmode will 6 print all usual lines, it just won't stop. batchmode will 5 suppress all but a handful of declarative 4 lines ("this is pdfTeX v3.14...").

These 3 can also be invoked from within the document 2 with \batchmode and \nonstopmode, but this is less useful for 1 the situation you're describing.

Score: 24

To simply ignore all output, redirect pdflatex 6 stdout to /dev/null:

system("pdflatex yourdocument >/dev/null");

You may want to add 5 \nonstopmode at the beginning of your document to instruct 4 tex to keep going even when encountering 3 errors.

To get the error messages, pipe pdflatex 2 output to your program and look for errors 1 around rows starting with !, e.g.

FILE *outputf = popen("pdflatex yourdocument", "r");

// ... read and analyze output from outputf ...

pclose(outputf);

More Related questions