Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was wondering if anyone has used Github as a version control system, when writing a large document via TexStudio or TexMaker?

Rstudio for example has a plugin that allows R projects to be pushed and pulled from the Github repository, making it very easy to manage committed changes, and committing them to the actual repo.

Is there a way to achieve this easily with a latex document 'project'.

share|improve this question

2 Answers 2

up vote 9 down vote accepted

You can run custom commands in Texmaker (User -> User Commands) as well as TeXstudio (Configure -> Build -> User Commands). With that it should be possible to call Git command line tools from within the editor. Moreover in TeXstudio, you can combine this with scripting and triggers, which allows you to automatically trigger these actions e.g. on file save.

If you tell me which git commands you need, I could provide example code.

Edit:

Below is an example for TeXstudio, in which the commands are called via scripting. Create the scripts at User Macros -> Edit Macros.... Since I'm not into git, I don't know if the actual git calls are correct, however it should illustrate the idea.

Pull:

Git pull command

A simple plain call to an external program. On first execution of the script TXS will ask you if you trust the script to execute external programs.

Push:

Git push command

This a bit more fancy. First, the script asks the user for a commit comment. Second, the trigger ?save-file means that the script is called everytime you save a file.

Of course, you can further extend the scripts according to your needs.

share|improve this answer
    
Thanks, just the standard push / pull and commit functionality.. –  Nicholas Hamilton May 5 '13 at 12:23
    
I am getting an error being thrown: Not a git repository (or any of the parent directories): .git, but I have set up a .git repository, and can push and pull from command line. –  Nicholas Hamilton May 6 '13 at 16:03
    
Probably need to set the working directory somehow –  Nicholas Hamilton May 6 '13 at 16:30
    
There is currently no official way to set the working dir. However, you can try to hack around this: A second argument to runCommand is interpreted as main file of the project and its path is used as working dir. So you can try runCommand("git pull", "d:\\yourpath\\dummy.tex"). - Afaik dummy.tex doesn't even have to exist, but I'm not sure about this. –  Tim Hoffmann May 7 '13 at 17:24
    
did the trick with: buildManager.runCommand("git push origin master", editor.fileName()) –  Nicholas Hamilton May 7 '13 at 19:51

There is no Git integration in either Texmaker or TeXStudio as far as I know. The latter has support for SVN, but that won't help if you wish to use GitHub. As such, if you would like to write in TeXStudio/Texmaker and use Git with your LaTeX projects, the Git stuff would have to be handled outside the editor, using a graphical client such as SmartGit or the terminal.

There may be other LaTeX editors that has Git integration. If you use Emacs for example, I can recommend magit.

share|improve this answer
3  
Yes, emacs + magit works perfectly for TeX projects. –  Alex May 4 '13 at 16:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.