#!/usr/bin/ruby 0.upto(7) do |i| Dir.chdir "sections/german/0#{i}" `ls -1 *.tex`.split("\n").map { |file| file.sub(/\.tex$/, '')}.each do |file| `pdflatex #{file}.tex` `pdfcrop #{file}.pdf` `pdf2svg #{file}.pdf #{file}-orig.svg` `pdf2svg #{file}-crop.pdf #{file}-crop.svg` `rm #{file}.aux` `rm #{file}.log` `rm #{file}.out` `rm #{file}.pdf` `rm #{file}.svg` `rm #{file}.toc` `rm #{file}-crop.pdf` end Dir.chdir "../../.." end