3

If I do pdflatex *.tex in a directory, only one tex file is compiled. Which syntax should I use that all *.tex files in the directory are compiled?

student
  • 17,875
  • 31
  • 103
  • 169
  • 3
    Btw, [`tex.stackexchange.com` has a valuable thread on "*tools for automating document compilation*"](http://tex.stackexchange.com/questions/64/tools-for-automating-document-compilation) – sr_ May 01 '12 at 09:00

3 Answers3

7

try

for file in *.tex; do pdflatex "$file"; done
jw013
  • 50,274
  • 9
  • 137
  • 141
Wojtek
  • 2,290
  • 2
  • 17
  • 24
6

pdflatex apparently only takes one argument. I can think of using find -exec

find -name '*.tex' -maxdepth 1 -exec pdflatex {} \;

But there may be better alternatives.

Bernhard
  • 11,992
  • 4
  • 59
  • 69
1

Less typing, if no spaces in files:

 echo *.tex|xargs -n1 pdflatex
gena2x
  • 2,387
  • 14
  • 20