Home > documentation, LaTeX, open source software, programming, Python > Default files for LaTeX projects

Default files for LaTeX projects

In a previous post, I dealt with generating default files for a GPL’ed project. In this post, I briefly talk about generating default files for a LaTeX project.

If you’re an avid LaTeX user like me, over time you would notice that there are a number of files that keep rearing their heads over and over again. For each new document that I write, I would create a Makefile containing the necessary commands for compiling my document and commands for cleaning up junk files. The junk files I’m referring to include, among others, the following types of file:

  • .aux
  • .bak
  • .bbl
  • .blg
  • .dvi
  • .log
  • .ps
  • .toc

Well, DVI and PS files are strictly not junk files. DVI files are useful for previewing your document during the writing process. PS files can be used for printing out hard copies of your documents. But I usually prefer to read the PDF files of the final drafts of my documents.

After using LaTeX for some time now, I realize that I often create files similar to the following:

  • Makefile — for storing useful commands
  • bibliography.bib — for BibTeX entries
  • template.tex — the master TeX file of my document

So here’s another no-brainer Python script to automagically generate the files in the above list. The script does appear to be a bit lengthy, but it’s not difficult for a Python beginner to understand. Just be patient and read through the script and you would notice that the following excerpt is the main part of that script:

fileNames = ["template.tex",\
fileContents = [TEX_MASTER,\
i = 0
while i < len(fileNames):
    path = [os.getcwd()]
    path = "".join(path)
    file = open(path, "w")
    i += 1

See… What did I tell you? No-brainer, right?

  1. 19 March 2009 at 2:26 pm

    Alternatively you can use rubber and avoid having to maintain a makefile at all.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: