Use a batch (or script) file to do complex operations like compiling a latex file in macosx

If you want to run a batch file (or script file) in macosx to compile a latex file where for compiling I mean bibtex, latex and skim read these two posts

How To Make and Run Batch Files In Terminal In Mac OSX

To summarize you can create a file ‘latexsript’ whose content is

#### latexscript file starts here


svn up

svn commit -m”dp automatic”

bibtex ./$FILENAME

latex ./$FILENAME.tex

latex ./$FILENAME.tex

dvips -o $ $FILENAME.dvi

ps2pdf $ $FILENAME.pdf

open ./$FILENAME.pdf

# tth ./$(FILENAME).tex

# zip -r *

# SVN ?

# cp $(FILENAME).pdf ~/Dropbox/Public/$(FILENAME).pdf

# cp $(FILENAME).html ~/Dropbox/Public/$(FILENAME).html

# cp $(FILENAME).tex ~/Dropbox/Public/$(FILENAME).tex

# cp todo.txt ~/Dropbox/Public/todo.txt

# rm -f *.aux *.log *.out *.ps *.toc *.nav *.snm *.dvi

#### latexscript file ends here

then you need to run in a terminal this command

> chmod 755 latexscript

and then simply run the script

> ./latexscript

Note that even if you change the contents of the file you do not need to run chmod again.



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s