a0f9cf043df69238b55081f683ccfe52d470ef08
[ach-master.git] / src / common / style.tex
1 %%%
2 %%% style.tex
3 %%% Stylistic configuration
4 %%%
5
6 % Colors
7 \definecolor{green}{RGB}{32,113,10}
8 \definecolor{orange}{RGB}{251,111,16}
9 \definecolor{red}{RGB}{247,56,0}
10 \definecolor{blue}{RGB}{0,28,128}
11 \definecolor{lightgreen}{RGB}{187,218,216}
12 \definecolor{intersectgreen}{RGB}{103,133,155}
13 \definecolor{darkblue}{RGB}{76,87,117}
14 \definecolor{Brown}{cmyk}{0,0.81,1,0.60}
15 \definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
16 \definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
17 \definecolor{lightlightgray}{gray}{0.9}
18
19 % Draft stuff
20 \ifdraft{
21   % Ensure that everything is neatly set up for us
22   \AtBeginDocument{
23     \def\draftInfo{%
24       Draft revision\gitVtags: \gitAbbrevHash{} %
25       (\gitCommitterIsoDate) \gitCommitterName}
26     \sbox{\draftWatermark}{%
27       \includegraphics[width=\paperwidth]{img/draft}}
28     \sbox{\draftPageLine}{%
29       \colorbox{black!10}{%
30         % enlarge box vertically by 2/3 lines
31         \raisebox{0pt}%
32         [\dimexpr .33\baselineskip + \height]%
33         [\dimexpr .33\baselineskip + \depth]{%
34           \makebox[\paperwidth]{\color{black!50}\draftInfo}}}}
35   }
36 }{}
37
38
39 %%% Fonts
40 % Fonts are loaded, now is the right time for mictorype.
41 \microtypesetup{stretch=9,shrink=15,step=3,tracking=smallcaps,letterspace=75}
42 % makes default font sans-serif
43  \renewcommand{\familydefault}{\sfdefault}
44
45 % Captions
46 \setcapindent{1em}
47 \addtokomafont{caption}{\small\itshape}
48 \addtokomafont{captionlabel}{\bfseries}
49
50 % Section headers
51 \addtokomafont{disposition}{\color{darkblue}\bfseries}
52
53 % Page foot
54 \setkomafont{pagefoot}{\normalfont\sffamily\footnotesize}
55 \ifoot%
56 [Applied Crypto Hardening\ifdraft{ % Space!
57   \textbullet{} \draftInfo}{}]%
58 {Applied Crypto Hardening \ifdraft{ % Space!
59     \textbullet{} \draftInfo}{}}
60 \cfoot[]{}
61 \ofoot%
62 [page \thepage\ of \pageref{LastPage}]%
63 {page \thepage\ of \pageref{LastPage}}
64 \renewcommand*{\chapterpagestyle}{scrheadings}
65 \pagestyle{scrheadings}
66
67 % Epigraph / dictum
68 \newcommand*{\epigraph}[3][]{\dictum[#3]{#2}\bigskip}
69 \renewcommand*{\dictumrule}{}
70 \renewcommand*{\dictumauthorformat}[1]{--- #1}
71 \addtokomafont{dictumtext}{\itshape}
72 \setkomafont{dictumauthor}{\normalfont}
73 \renewcommand{\dictumwidth}{8cm}
74
75 % Graphics
76 %tell TeX where to look for graphics/logos
77 \graphicspath{ {/img/} }
78
79 % This block is for listings
80 \usepackage[framemethod=TikZ]{mdframed} % mdframed is used to draw a grey box
81 \mdfdefinestyle{listingstyle}{
82   backgroundcolor=black!10,outerlinewidth=0,outerlinecolor=black,
83   innerleftmargin=9pt,innerrightmargin=0,innertopmargin=3pt,innerbottommargin=2pt
84 }
85 %\usepackage{amssymb}% for \curvearrowright
86 % Insert a grey box behind the listing for uniform background color (The \cipherstring would the listing and the background would turn white)
87 \BeforeBeginEnvironment{lstlisting}{\vspace{0.2cm}\begin{mdframed}[style=listingstyle]}
88 \AfterEndEnvironment{lstlisting}{\end{mdframed}}
89 % Listings
90 \lstset{
91   basicstyle=\ttfamily,
92   keywordstyle=\color{OliveGreen},
93   commentstyle=\color{gray},
94   backgroundcolor=\color{lightlightgray},
95   upquote=true,
96   showstringspaces=false,
97   tabsize=2,
98   captionpos=b,
99   breaklines=true,
100   breakatwhitespace=false,
101   inputencoding=utf8,
102   breakatwhitespace=false,
103   showspaces=false,
104   columns=fullflexible,                   % Column format: no spaces are inserted for monospaced appearance
105   breakindent=10pt,
106   morekeywords={__global__, __device__},% 
107   escapechar=\`,
108   escapeinside={\%*}{*)},                 % Escape TeX commands inside %* and *)
109 %  prebreak=\mbox{$\curvearrowright$},     % Disply curved arrow before linebreak
110   prebreak=\small\symbol{'134},
111 }
112
113
114 % Hyperref styles
115 \hypersetup{%
116   breaklinks,%
117   colorlinks,%
118   linkcolor=darkblue,citecolor=blue,urlcolor=blue,%
119   breaklinks=true,%
120   unicode,%
121   pdfnewwindow=true,%
122   final
123 }
124 \urlstyle{same}
125
126 % Bibliography
127 \bibliographystyle{alphalink}
128
129 % Disable single lines at the start of a paragraph (Schusterjungen)
130 \clubpenalty = 10000
131 % Disable single lines at the end of a paragraph (Hurenkinder)
132 \widowpenalty = 10000 
133 \displaywidowpenalty = 10000 % formulas
134 \setlength{\textfloatsep}{\baselineskip}
135 \setlength{\floatsep}{\baselineskip}
136
137 \frenchspacing
138 \raggedbottom
139
140 % customized spaces between text and footnotes
141 \setlength{\skip\footins}{2\baselineskip}
142
143 % Better float parameters: (from the TeX FAQ)
144 \renewcommand{\topfraction}{.85}
145 \renewcommand{\bottomfraction}{.7}
146 \renewcommand{\textfraction}{.15}
147 \renewcommand{\floatpagefraction}{.66}
148 \renewcommand{\dbltopfraction}{.66}
149 \renewcommand{\dblfloatpagefraction}{.66}
150 \setcounter{topnumber}{9}
151 \setcounter{bottomnumber}{9}
152 \setcounter{totalnumber}{20}
153 \setcounter{dbltopnumber}{9}
154
155 %%% Local Variables: 
156 %%% mode: latex
157 %%% TeX-master: "../applied-crypto-hardening"
158 %%% End: