FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use a scaling factor for all sizes · screamwork/visual-git-guide@ba0079f · GitHub

Commit ba0079f

Browse files
committed
Use a scaling factor for all sizes
Instead of hardcoding all the units in the styles, use \g in place of cm, \gLine in place of pt, and \gFont in place of \Large. Now, it is easy to scale the size of the images by changing these three parameters. This scaling is not perfect, and you're limited to increments of the font size, but it's still a heck of a lot easier than adjusting all the dimensions manually. Thanks for Thomas Koch for the idea.
1 parent cc723fe commit ba0079f

5 files changed

Lines changed: 43 additions & 29 deletions

File tree

‎basic-usage.tex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
\input{common.tex}
2-
\geometry{papersize={21cm,9cm}}
2+
\geometry{papersize={21\g,9\g}}
33
\begin{document}
44
\begin{tikzpicture}[main]
55
\boundingbox

‎checkout-b-detached.tex‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
\olddetachedHEAD -> 2;
1010

1111
\begin{pgfonlayer}{HEAD}
12-
\node [branch, double shadow, above right=.4cm of 2, draw=none, fill=none]
13-
{};
12+
\node [branch, double shadow, above right=.4\g of 2, draw=none, fill=none]
13+
{};
1414
\end{pgfonlayer}
15-
\node [branch, above right=.4cm of 2] (new) {new};
15+
\node [branch, above right=.4\g of 2] (new) {new};
1616
\path [branch line] (new) edge (2);
1717
\HEAD -> new;
1818

‎common.tex‎

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
\documentclass[12pt]{article}
22
\usepackage[latin1]{inputenc}
33
\usepackage{cmbright}
4-
\usepackage[pdftex,margin=0pt,papersize={24cm,14cm},noheadfoot]{geometry}
4+
\usepackage[pdftex,margin=0pt,noheadfoot]{geometry}
55
\usepackage{tikz}
66
\usetikzlibrary{shapes,arrows,shadows,positioning,calc}
77

@@ -13,51 +13,63 @@
1313
\colorlet{old HEAD}{HEAD!50}
1414
\colorlet{old branch}{branch!50}
1515

16+
% Global Scaling Factors
17+
% Values that seem reasonable:
18+
% 1cm / 1pt / \Large
19+
% .5cm / .5pt / \scriptsize
20+
\newlength\g
21+
\setlength\g{1cm}
22+
\newlength\gLine
23+
\setlength\gLine{1pt}
24+
\newcommand\gFont{\Large}
25+
26+
\geometry{papersize={24\g,14\g}}
27+
1628
\tikzset{
17-
index/.style={rectangle, text width=5cm, text centered, rounded corners,
18-
minimum height=1.5cm, line width=3pt, fill=#1!50, draw=#1},
29+
index/.style={rectangle, text width=5\g, text centered, rounded corners,
30+
minimum height=1.5\g, line width=3\gLine, fill=#1!50, draw=#1},
1931
index/.default={index},
2032
history/.style={index=commit, fill=commit!40},
2133
work/.style={index=work},
2234
%
23-
object/.style={rectangle, text width=2cm, text centered, rounded corners,
24-
minimum height=1cm, line width=3pt, fill=#1!50, draw=#1},
35+
object/.style={rectangle, text width=2\g, text centered, rounded corners,
36+
minimum height=1\g, line width=3\gLine, fill=#1!50, draw=#1},
2537
object/.default={red},
2638
commit/.style={object=commit, fill=commit!40},
2739
new commit/.style={commit, double shadow},
2840
branch/.style={object=branch},
2941
HEAD/.style={object=HEAD},
3042
old branch/.style={object=old branch, text=black!30},
3143
old HEAD/.style={object=old HEAD, text=black!30},
32-
attached HEAD/.style={HEAD, minimum height=2cm},
44+
attached HEAD/.style={HEAD, minimum height=2\g},
3345
attached HEAD label/.style={object, draw=none, fill=none},
34-
old attached HEAD/.style={old HEAD, minimum height=2cm},
46+
old attached HEAD/.style={old HEAD, minimum height=2\g},
3547
old attached HEAD label/.style={attached HEAD label, text=black!30},
3648
%
3749
double shadow/.style={
38-
preaction={fill=#1,transform canvas={xshift=.2cm,yshift=-.2cm}},
39-
preaction={fill=#1,transform canvas={xshift=-.2cm,yshift=.2cm}},
50+
preaction={fill=#1,transform canvas={xshift=.2\g,yshift=-.2\g}},
51+
preaction={fill=#1,transform canvas={xshift=-.2\g,yshift=.2\g}},
4052
},
4153
double shadow/.default={yellow!75},
4254
%
43-
line/.style={>=stealth', line width=1.5pt, draw=black!70, auto=right,
55+
line/.style={>=stealth', line width=1.5\gLine, draw=black!70, auto=right,
4456
bend right},
45-
object line/.style={>=stealth, line width=1.5pt},
57+
object line/.style={>=stealth, line width=1.5\gLine},
4658
commit line/.style={object line, color=commit},
4759
new commit line/.style={commit line},
4860
HEAD line/.style={object line, color=HEAD},
4961
branch line/.style={object line, color=branch},
5062
old HEAD line/.style={object line, color=old HEAD},
5163
old branch line/.style={object line, color=old branch},
52-
cancel ref/.style={cross out, draw=black!70, line width=1pt},
64+
cancel ref/.style={cross out, draw=black!70, line width=1\gLine},
5365
%
54-
background line/.style={draw=white, line width=6pt,
55-
shorten >=6pt, shorten <=6pt},
66+
background line/.style={draw=white, line width=6\gLine,
67+
shorten >=6\gLine, shorten <=6\gLine},
5668
%
57-
cmd/.style={color=black, font={\Large\ttfamily}},
69+
cmd/.style={color=black, font={\gFont\ttfamily}},
5870
%
59-
main/.style={node distance=.7cm, bend angle=35, font={\Large},
60-
x=1.5cm, y=1.5cm},
71+
main/.style={node distance=.7\g, bend angle=35, font={\gFont},
72+
x=1.5\g, y=1.5\g},
6173
every edge/.style={draw, ->},
6274
}
6375

@@ -85,15 +97,15 @@
8597
}
8698

8799
\def\ref [#1] "#2" : #3 -> #4;{
88-
\node [#1, above=.4cm of #4] (#3) {#2};
100+
\node [#1, above=.4\g of #4] (#3) {#2};
89101
\path [#1 line] (#3) edge (#4);
90102
}
91103
\def\oldref [#1] "#2" : #3 -> #4;{
92104
\ref [old #1] "#2" : old #3 -> #4;
93-
\node [cancel ref, above=.2cm of #4, anchor=center] {};
105+
\node [cancel ref, above=.2\g of #4, anchor=center] {};
94106
}
95107
\def\refbelow [#1] "#2" : #3 -> #4;{
96-
\node [#1, below=.4cm of #4] (#3) {#2};
108+
\node [#1, below=.4\g of #4] (#3) {#2};
97109
\path [#1 line] (#3) edge (#4);
98110
}
99111

@@ -120,13 +132,15 @@
120132
\def\addHEAD [#1] "#2" : #3 -> #4;{
121133
\begin{pgfonlayer}{HEAD}
122134
\node [#1, anchor=south] (#3) at (#4.south) {};
123-
\node [#1 label, anchor=south] (#3 label) at ($(#4.north)+(0,-3pt) $) {#2};
135+
\node [#1 label, anchor=south] (#3 label) at ($(#4.north)+(0,-3\gLine)
136+
$) {#2};
124137
\end{pgfonlayer}
125138
}
126139
\def\addHEADbelow [#1] "#2" : #3 -> #4;{
127140
\begin{pgfonlayer}{HEAD}
128141
\node [#1, anchor=north] (#3) at (#4.north) {};
129-
\node [#1 label, anchor=north] (#3 label) at ($(#4.south)+(0,3pt) $) {#2};
142+
\node [#1 label, anchor=north] (#3 label) at ($(#4.south)+(0,3\gLine)
143+
$) {#2};
130144
\end{pgfonlayer}
131145
}
132146

‎conventions.tex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
(-5,3) node {another branch} edge [->] (maint)
1414
(-5,-0.5) node {files to go in next commit} edge [->] (index)
1515
(-5,-2) node {files that you ``see''} edge [->] (work)
16-
(5,-1) node [text width=6cm, text badly centered]
16+
(5,-1) node [text width=6\g, text badly centered]
1717
{commit objects, identified by SHA-1 hash}
1818
edge [->] (E)
1919
edge [->] (D)

‎merge.tex‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% draw the old branch manually with a long line
1313
\node [old branch, above=1 of E] (old master) {master};
1414
\path [old branch line] (old master) edge (E);
15-
\node [cancel ref, above=.2cm of E, anchor=center] {};
15+
\node [cancel ref, above=.2\g of E, anchor=center] {};
1616
\oldHEAD -> old master;
1717

1818
\newcommit f8bc5 (F) -> E;
@@ -23,7 +23,7 @@
2323

2424
\node [cmd] at (0, 3.75) {git merge other};
2525

26-
\node [inner sep=8pt] (merge) at (0,-1) {3-way merge};
26+
\node [inner sep=8\gLine] (merge) at (0,-1) {3-way merge};
2727

2828
\path [background line]
2929
(3) edge [-, bend right=15] (merge)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL