How to Run gitdags on Ubuntu 14.04 LTS

These instructions show how to run LaTeX on the example document and produce a PDF outout.

Installing the prerequisites

Gigdags requires three prerequsites * a LaTeX distribution, * the tikz package (v3.0 or later), * the xcolor-solarized package.

Installing a LaTex distribution

First, do NOT use apt-get to install. The best is to install TexLive from the Tex Users Groug (TUG).

  1. Download the latest install file, using your wget or your browser.

    ~$ cd ~/Downloads
    ~/Downloads$ wget mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
    

    This will create the file install-tl-unx.tar.gz

  2. Uncompress the gzip file:

    ~/Downloads$ tar xzf install-tl-unx.tar.gz
    
  3. cd into uncompressed directory and run install-tl

    ~/Downloads$ cd install-tl-20150208
    ~/Downloads$ ./install-tl
    

    This is a LONG process and may take an hour to load the nearly 4000 modules

    * Note: If you have file or directory permission issues, run with sudo

    ~/Downloads$ sudo ./install-tl
    
  4. Following the Post-Install instructions, Update PATH

    Adding texlive to your current session PATH:

    ~/Downloads$ PATH=/usr/local/texlive/2014/bin/x86_64-linux:$PATH
    

    Adding texlive to your ~/.bashrc file for future sessions:

    export PATH="/usr/local/texlive/2014/bin/i386-linux:$PATH"
    
  5. Testing your current set-up:

    In a directory you can write to, try basic document processing:

    ~$ latex small2e
    [...]
    Output written on small2e.dvi (1 page, 1780 bytes).
    ~$ ls
    small2e.aux  small2e.dvi  small2e.log
    

Installing tikz Package (v3.0 or later)

The tikz package is part of the rpf package. The latest TexLive install includes a sufficent version of rpf. Use tlmgr (TexLive package manager) to check your verion of rpf:

~$ tlmgr info pgf
package:     pgf
category:    Package
shortdesc:   Create PostScript and PDF graphics in TeX.
longdesc:    PGF is a macro package for creating graphics. It is platform- and format-independent and works together with the most important TeX backend drivers, including pdftex and dvips. It comes with a user-friendly syntax layer called TikZ. Its usage is similar to pstricks and the standard picture environment. PGF works with plain (pdf-)TeX, (pdf-)LaTeX, and ConTeXt. Unlike pstricks, it can produce either PostScript or PDF output.
installed:   Yes
revision:    33057
sizes:       src: 349k, doc: 13197k, run: 4993k
relocatable: Yes
cat-version: 3.0.0
cat-date:    2014-02-26 21:08:13 +0100
cat-license: lppl1.3
collection:  collection-pictures

Installing the xcolor-solarized Package.

The easiest way to install package files is to place them on your TeX search path. To find your default location use kpsewhich (included with TexLive).

  1. Create a default directory on your TeX search path:

    ~$ kpsewhich -var-value=TEXMFHOME
    /home/USER/texmf
    

    Create a tex/latex directory in this location:

    ~$ cd `kpsewhich -var-value=TEXMFHOME`
    /home/USER/texmf$ mkdir tex
    /home/USER/texmf$ mkdir tex/latex
    /home/USER/texmf$ cd tex/latex
    
  2. Change to the new tex/latex directory

    /home/USER/texmf/tex/latex$ cd tex/latex
    
  3. Use git** to clone xcolor-solarized locally

    Use git to clone the xcolor-solorized repository and create a local xcolor-solorized directory:

    /home/USER/texmf/tex/latex$ git clone https://github.com/Jubobs/xcolor-solarized.git
    

    Check to see if gitdags.sty can be seen by TeX

    ~$ kpsewhich xcolor-solarized.sty
    /home/USER/texmf/tex/latex/gitdags/xcolor-solarized.sty
    

    ** To install git use:

        sudo apt-get update
        sudo apt-get install git
        

Installing gitdags Package

Similar to the last step in the previous section, use git to clone the gitdags repository and create a local gitdags directory

~$ cd /home/USER/texmf/tex/latex
/home/USER/texmf/tex/latex$ git clone https://github.com/Jubobs/gitdags.git

Check to see if gitdags.sty can be seen by TeX

~$ kpsewhich gitdags.sty
/home/USER/texmf/tex/latex/gitdags/gitdags.sty

Genating a PDF of the Example Document

Use cut-and-paste to copy the example DAG document file to a local file, for example "dagfile.tex". The use the pdflatex command to create a PDF.

~$ pdflatex dagfile.tex
[...]
Output written on dagfile.pdf (1 page, 86347 bytes).
Transcript written on dagfile.log.

The Results

After installing ImageMagick on Ubuntu, I followed the instructions on SO to convert the PDF to a PNG using ImageMagick

To change the PDF to "fit" the diagram rather than be a full page sheet, change the document class to:

\documentclass[preview]{standalone}

Converting the image from pdf to png using:

convert -density 300 dagfile.pdf -quality 90 dagfile.png

Git DAG Graph