0

When using a makefile to generate PDFs from LaTeX or MarkDown with pandoc, how can one automatically check the resulting PDFs for errors, that the code/text editor might not find?

Katrin Leinweber
  • 1,316
  • 13
  • 33

1 Answers1

2

If the errors are known & can be reg-ex'd (such as duplicate words), write those down line-by-line in a file (e.g. called CHECKS). Then, use the following commands in the makefile:

pdftotext file.pdf - | \  # sends content of PDF to stdout & pipes it into...
grep \
    --color \             # highlights errors in stdout
    --ignore-case \
    --extended-regexp \
    --file=CHECKS         # contains the error patterns

Appended to the make target of the PDF, this IMHO helps to prevent particularly repetitive errors.

PS: Summarised from a German blog post. Real-life example here.

Katrin Leinweber
  • 1,316
  • 13
  • 33