I am executing pdflatex from php script and it gives me very long list of log entries mixed with errors e.g

 system('/usr/texbin/pdflatex    -output-directory=./temp/tex '.$tex_output  . "   1> /dev/null  ",$firstRun); 

log output

Is it possible to get errors or warnings only (may be using logs files it generates ) ?

  • Well, cat filename.log | grep -iB2 -A5 "error\|warning" However, the log file you linked seems to be missing end-of-line characters, which is not a fault of TeX. – yo' Nov 15 '12 at 9:41
  • 3
    The output can be minimized using option --interaction=batchmode. The exit code of the command is set, if there were any errors. – Heiko Oberdiek Nov 15 '12 at 10:24

Error always starts with <exclamationmark><space>, which should be easy to look for in the log.

As well, you can pipe something like x\nx\n to the program latex, which should make it stop after first error. Then you can search it even easier, I believe that the last empty line in the log should be just after this error. (This is because after you exit after an error, only some final font information and memory usage is written into the log.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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