Commit e5236600 authored by Lukas Nagel's avatar Lukas Nagel
Browse files

create graphic for example

parent 5cda77ad
versionsgraph=\
ex1-graph.pdf
all=\
$(versionsgraph)
default: $(all)
$(all): theme.tex
$(versionsgraph): versiongraph.tex
%.pdf: %.tex
latexrun --latex-cmd lualatex -o $@ -O $*.out $<
polish:
rm -rf *.out
clean: polish
rm -f *.pdf
.PHONY: polish workingtree
\documentclass{standalone}
\input{theme}
\input{versiongraph}
\begin{document}
\begin{tikzpicture}[versionsgraph]
\commit{\rootcommit}{lightblue}{};
\commit[right=of \rootcommit]{\trackcommit}{lightblue}{\rootcommit};
\branch[above right]{master}{\trackcommit}
\HEAD{master}
\message{\rootcommit}{initial}
\message{\trackcommit}{pep8}
\end{tikzpicture}
\end{document}
\usepackage{fontspec}
\usepackage{xcolor}
\setmonofont{Fira Mono}
\setsansfont{Fira Sans}
\setmainfont{Fira Sans}
\definecolor{nontext}{gray}{0.4}
\definecolor{text}{gray}{0.95}
\definecolor{lightblue}{rgb}{0.7, 0.7, 0.9}
\definecolor{lightgreen}{rgb}{0.7, 0.9, 0.7}
\definecolor{lightred}{rgb}{0.9, 0.7, 0.7}
\definecolor{lightyellow}{rgb}{0.9, 0.9, 0.7}
\usepackage{luacode}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\def\rootcommit{4200}
\def\trackcommit{4201}
\newcommand\hash[2][0]{
\directlua{
math.randomseed(#1)
chars = "123456789ABCDEF"
ret = ""
for i = 1, #2, 1
do
r = math.random(0, 15)
c = string.sub(string.sub(chars, r), 0, 1)
ret = ret .. c
end
tex.print(ret)
}
}
\newcommand\commit[4][]{
\node[commit=#3,#1] (#2) {\hash[#2]{7}};
\draw[parent]
\foreach \parent in {#4}
{(#2) -> (\parent)}
;
}
\newcommand\branch[3][above]{
\node[branch,#1=.5cm of #3] (#2) {#2};
\draw[branchpointer] (#2) -- (#3);
}
\newcommand\HEAD[2][above]{
\node[HEAD, #1=.2cm of #2] (HEAD) {HEAD};
\draw[branchpointer] (HEAD) -- (#2);
}
\renewcommand\message[3][above]{
\node[message, #1=.2cm of #2] (#3) {#3};
\draw[branchpointer] (#3) -- (#2);
}
\usetikzlibrary{positioning}
\tikzstyle{versionsgraph}=%
[ cap=round
, draw=nontext
, line width=0.2mm
]
\tikzstyle{HEAD}=%
[ rectangle
, rounded corners=2pt
, fill=gray!50
, text=black!70
]
\tikzstyle{branch}=%
[ rectangle
, rounded corners=2pt
, fill=lightgreen
]
\tikzstyle{message}=%
[rectangle
, fill=lightyellow
, dashed
, draw
, font=\scriptsize
]
\tikzstyle{branchpointer}=%
[ draw
, dashed
, ->
, thin
, >=stealth
]
\tikzstyle{parent}=%
[ draw
, ->
, thick
, >=stealth
]
\tikzstyle{commit}=%
[ circle
,fill=#1
, draw
, align=center
, inner sep=0
, font=\tt\scriptsize
]
......@@ -209,6 +209,7 @@
\end{Beispiel}
\center
\begin{figure}
\includegraphics{../grafiken/ex1-graph}
\end{figure}
\end{frame}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment