As I wrote in my last post, I like to
use the LaTeX package gitdags
when a visual representation of an exemplary git
graph is needed.
In this post, I shortly show my workflow when creating these graphs.
\documentclass[preview]{standalone}
\usepackage{gitdags}
\begin{document}
\centering
\begin{tikzpicture}
% Commit DAG
\gitDAG[grow right sep = 2em]{
A -- B -- C
};
\end{tikzpicture}
\end{document}
produces this graph
The import thing to note here is the chosen documentclass
which crops the
resulting pdf to be as big as the content.
\documentclass[preview]{standalone}
When running pdflatex graph.tex
you would get such a pdf. To convert the pdf
into a png, I use ImageMagick. On a Mac, it’s as
easy to get as to type
$ brew install imagemagick
Then, for converting the pdf into png, use ImageMagicks convert
method.
$ convert graph.pdf graph.png
I wrote a small bash script which lets me specify input and ouput directories, does the conversion from tex to png and later throws away all pdf generation files.
A Makefile would probably be much better as it would only build files which changed, not the whole directory. As for now, I will stick with the bash script given that the amount of files is rather small. If I ever switch to Make, I’ll update this post accordingly.