To get rid of all the annoying compile commands during the daily work with latex, i wrote a little bash script. The following commands were necessary to create the latex document. They should work on all common linux systems:
1 2 3 4 5 6 7 |
pdflatex -interaction nonstopmode 1_base.tex bibtex 1_base makeglossaries 1_base makeindex -q -s special.ist 1_base.idx makeindex -q 1_base.nlo -s nomencl.ist -o 1_base.nls pdflatex -interaction nonstopmode 1_base.tex pdflatex -interaction nonstopmode 1_base.tex |
I also added some more useful features in the script:
nice -n 19 … [command];… puts the process in the background, so i can continue working
… > 1_base_script_1-run.log; … writes the feedback in a log file
echo “(1/6) pdflatex 1 done, go for bibtex …”;… gives me feedback on the progress of the script
cp 1_base.pdf pdf; … copies the output in another directory (here: pdf). I could not scroll the pdf while pdftex generated the new version, so i always looked at the current copy which is updated much faster.
cat 1_base_script_6-run.log | grep error;… i used to ignore the errors, so they accumulated … fatal from time to time. Therefore i made the script spitting them back to me every time it runs.
Of course there are endless ways to pimp the script to your needs … this was ok for me.
Here is the complete bash script (check for unintended line breaks):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash echo “(0/6) takes roughly 40 (draft) to 70 (fine) sec … “; nice -n 19 pdflatex -interaction nonstopmode 1_base.tex > 1_base_script_1-run.log; cat 1_base_script_1-run.log | grep error; echo “(1/6) pdflatex 1 done, go for bibtex … “; nice -n 19 bibtex 1_base > 1_base_script_2-bibtex.log; cat 1_base_script_2-bibtex.log | grep error; echo “(2/6) bibtex done, go for glossaries … “; nice -n 19 makeglossaries 1_base >> 1_base_script_5-makeglossaries.log; cat 1_base_script_5-makeglossaries.log | grep error; echo “(3/6) gloss done, go for index … “; nice -n 19 makeindex -q -s special.ist 1_base.idx > 1_base_script_3-index.log; cat 1_base_script_3-index.log | grep error; echo “(4/6) index done, go for abbrv … “; nice -n 19 makeindex -q 1_base.nlo -s nomencl.ist -o 1_base.nls >> 1_base_script_4-nomenclature.log; cat 1_base_script_4-nomenclature.log | grep error; echo “(5/6) abbrv done, go for pdflatex 2 … “; nice -n 19 pdflatex -interaction nonstopmode 1_base.tex >> 1_base_script_6-run.log; cp 1_base.pdf pdf/; cat 1_base_script_6-run.log | grep error; cat 1_base_script_6-run.log | grep error >> /home/ralf/Dresden/diss/1_base.errors; cat 1_base_script_6-run.log | grep warn >> /home/ralf/Dresden/diss/1_base.warnings; echo “(6/6) pdflatex 2 done, enjoy your logs…”; ls | grep “log”; echo “… and errors: 1_base.errors, 1_base.warnings”; exit; |