Monthly Archives: May 2012

Git + LaTeX + TeXnicCenter

Using Git and LaTeX can be fun to get up and running, but its even more fun if you want to use an editor like TeXnicCenter.

The main problem in using TeXnicCenter and attempting to collaborate with others over git is what to do with TeXnicCenter project and Latex build files. By default these files will be put in the directory where your tex files are which will cause problems when you go to push your changes. You can add all the files to .gitignore but that is a bit of a pain. Instead create a sub directory (lets call it “projectFiles”) and copy all the build files into it. Then in TeXnicCenter open Build -> “Define Output Profiles” and add the following to the latex compile command line arguments “-aux-directory=projectFiles” Now when you compile Latex all the build files will be put in this directory.

If you are using projects in TeXnicCenter then you will have one further .tcp file in the root directory. This is the project settings file. You can manually move this to the “projectFiles” directory also but make sure to update the path to the MainFile to reference the parent directory. For example “../Main_file.tex”.

Also to get BixTeX to build you will have to specify where you moved the .aux file so open Build -> “Define Output Profiles” and add the following to the BibTex command line arguments “projectFilesPath\%tm” replacing projectFilesPath with the full path to the project files folder. Note if you have other arguments already in there you might to overwrite.

Now that we have all the build and project files organized we can simply add an entry to .gitignore to instruct it to ignore the “projectFiles” directory.

Get updates changes from Git

git fetch origin
git merge origin/master

Push you changes

git commit -am 'comment'
git push origin master

Tagged ,

Blog Moved

Normal service is resumed, which means I’ll probably be back here in a year or so 😉

%d bloggers like this: