The goals of this project are to develop a simple little web-server that allows collaborators to work on a version controlled LaTeX document. The intent is for this server to run on a single computer, serving up latex documents with a simple web interface that allows users to login, edit the document, preview the results, then commit their changes.


  • CherryPy: This is the web framework.::
    pip install cherrypy

Developping HgLaTeX

Current Status

  • Basic working version: calls latexmk and shows output. To run, go into the hglatex subdirectory, and run python The following files in this directory are important: :

    This is the entire application.

    config :

    Configuration. This is where the paths are currently hardcoded.

    templates/edit.html :

    Template for the html file. Uses Jinja2 syntax.

    _build/preamble.tex :

    The latex stuff gets built in this directory. The preamble.tex file will have all the formatting (not to be edited by the used). The creation and population of this directory should be controlled by the app. (It should be cleared when started etc.)

    In addition, this application depends on CodeMirror which is included at the top level.

To Do

  • Hook into bitbucket.

  • Run a separate app for each user (probably easier than having credentials right now).

  • Hardcoded paths for my laptop. Need to be fixed.

  • Interface needs work. The idea is that a single button reflects the state of the document as follows:

    Done :

    The document has been compiled without errors, and the current version will be committed when "Done" is clicked.

    Preview :

    The document has been modified and needs to be previewed before committing. (I need to do some js manipulations so that this gets toggled when the text is modified.)

    Please Fix :

    There was an error compiling the document. User should check the log file.


  • The edit/preview/save cycle should save work so that if the users browser crashes, they can recover.
  • The commit cycle should check that the document compiles, ask for a comment about the nature of the changes (forming the basis for the commit message), and then commit the changes to a common mercurial repository.
  • Syntax highlighting editor.
  • Simple to use and code!


  • CodeMirror: A very nice looking code editor for a web-server. Has a LaTeX mode. Perfect!
  • CherryPy: Very simply python based web framework. {{pip install cherrypy}} works. Seems to have some authentication.