/
preamble.tex
258 lines (237 loc) · 9.48 KB
/
preamble.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
% set fonts for nicer pdf view
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}
\fancyheadoffset{12pt}
\renewcommand{\sectionmark}[1]{} % Don't use sections in headers
\renewcommand{\subsectionmark}[1]{} % Don't use subsections in headers
\usepackage{pdflscape}
\usepackage{geometry}
\newenvironment{wide}{
\pagebreak
\newgeometry{
top=15mm,
inner=15mm,
outer=15mm,
bottom=15mm,
headheight=15pt,
headsep=5mm,
footnotesep=5mm,
footskip=10mm}
\begin{landscape}
% Use TiKZ?
% http://tex.stackexchange.com/questions/40501/using-restoregeometry-in-environment-next-page-runs-off-the-page-bottom/40503#40503
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt} % default: \parindent
\setlength\LTright{0pt} % default: \fill
}{
\end{landscape}
\pagebreak
\aftergroup\restoregeometry
}
\usepackage{color}
\definecolor{updated}{rgb}{0.8,0.85,1}
\usepackage{numprint}
\newcommand{\readsinglelinefile}[1]{
\newread\inputstream%
\immediate\openin\inputstream=#1%
\immediate\read\inputstream to \singlelinecontents%
\singlelinecontents%
\immediate\closein\inputstream%
}
\providecommand{\versiononly}{\IfFileExists{.generated.version}{\readsinglelinefile{.generated.version}}{(Unknown~document~version)}}%
\providecommand{\versionandtoday}{\versiononly~--~\today}
\providecommand{\recentlyupdated}{\emph\textsc\textcolor{updated}{ ~Updated!~ }}
\usepackage{longtable}
\usepackage{caption}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{array}
\pgfplotsset{compat=1.11}% supress warning
\pgfplotstableset{
% Write all longtable tables to disk.
every table/.append style={outfile={.generated.report-table\@arabic\c@LT@tables.tex}},
% Use cached/written files as input.
include outfiles,
% Change to true to force re-generation. It's easier to just delete all generated files.
force remake=false,
}
\newcolumntype{i}{>{\begin{pgfplotstablecoltype}[int detect]}r<{\end{pgfplotstablecoltype}}}
\newcolumntype{f}{>{\begin{pgfplotstablecoltype}[fixed zerofill]}r<{\end{pgfplotstablecoltype}}}
% TODO: reduce code-duplication between \tsvtablestyle/wide/widedatasets/superwidedatasets
\newcommand{\tsvtablestyle}[0]{
\pgfplotstableset{
format=file,
col sep=tab,
multicolumn names={c},
column type=r,
int detect,
zerofill=true,
precision=3,
1000 sep={\ },
begin table=\begin{longtable*},
end table=\end{longtable*},
every odd row/.style={before row={\rowcolor[gray]{0.95}}},
every head row/.style={before row=\toprule,after row={
\toprule
\addlinespace[0pt]
\endhead
},
},
every last row/.style={after row={
\bottomrule
}
},
}
}
\newcommand{\tsvtable}[3]{
\tsvtablestyle
\pgfplotstabletypeset[
columns={#2},#3
]{#1}
}
\newcommand{\tsvtablestylewide}[1]{
\pgfplotstableset{
format=file,
col sep=tab,
multicolumn names={c},
column type=r,
int detect,
zerofill=true,
precision=3,
1000 sep={\ },
begin table=\begin{longtable},
end table=\end{longtable},
every odd row/.style={before row={\rowcolor[gray]{0.95}}},
every head row/.style={before row=\toprule,after row={
\toprule
\addlinespace[0pt]
\endhead
},
},
every last row/.style={after row={
\bottomrule
\caption{#1}}
},
}
}
\newcommand{\tsvtablewide}[4]{
\tsvtablestylewide{#2}
\pgfplotstabletypeset[
columns={#3},#4
]{#1}
}
\newcommand{\tsvtablewidedatasets}[4]{
\tsvtablestylewide{#2}
\pgfplotstabletypeset[
columns={#3},every nth row={4[-1]}{after row={\addlinespace[0pt]\midrule\addlinespace[0pt]}},fixed,display columns/0/.style={string type, column type=l},display columns/1/.style={string type, column type=i},#4
]{#1}
}
\newcommand{\tsvtablesuperwidedatasets}[4]{
\tsvtablestylewide{#2}
\pgfplotstabletypeset[
columns={#3},force remake=true,every nth row={4[-1]}{after row={\addlinespace[0pt]\midrule\addlinespace[0pt]}},fixed,display columns/0/.style={string type, column type=l},display columns/1/.style={string type, column type=i},%
% Remove dataset dates.
display columns/0/.append style={string replace*={2014-09-01.}{}},%
display columns/0/.append style={string replace*={2014-08-29.}{}},%
display columns/0/.append style={string replace*={2014-07-23.}{}},%
display columns/0/.append style={string replace*={2014w35.}{}},%
display columns/0/.append style={string replace*={2014-07-10.}{}},%
% Shorten health status datasets.
display columns/0/.append style={string replace*={healthstatus.2013.}{hs.}},%
display columns/0/.append style={string replace*={.domain-registrars}{.registrars}},%
display columns/0/.append style={string replace*={.financial-services}{.financial}},%
display columns/0/.append style={string replace*={.higher-education}{.education}},%
display columns/0/.append style={string replace*={.public-authorities}{.pubauth}},%
% Shorten dataset counts.
display columns/0/.append style={string replace*={100000}{100k}},%
display columns/0/.append style={string replace*={10000}{10k}},%
% Shorten dataset type.
display columns/0/.append style={string replace*={random.}{rnd.}},%
display columns/0/.append style={string replace*={-https-www}{-sw}},%
display columns/0/.append style={string replace*={-https}{-s}},%
display columns/0/.append style={string replace*={-http-www}{-hw}},%
display columns/0/.append style={string replace*={-http}{-h}},%
,#4
]{#1}
}
\newenvironment{futurework}{
\begin{center}
\begin{minipage}{.8\columnwidth}
\hspace{12pt}
\hrule
\hspace{12pt}
}{
\hspace{12pt}
\hrule
\hspace{12pt}
\end{minipage}
\end{center}
}
% Speed up pgfplots/tikz figure generation by caching results.
% LyX needs to be configured per user;
% In LyX Preferences, File Handling, Converters:
% For LaTeX (pdflatex) -> PDF (pdflatex) set the Converted field to:
% pdflatex -shell-escape $$i
% (Adding -shell-escape is what is important.)
\usepgfplotslibrary{external}
% When using LyX, the command is executed in a temporary working directory; can't use a folder prefix.
\tikzexternalize[prefix=.generated.]
% Use to remake all or remake a single figure.
%\tikzset{external/force remake}
%\tikzset{external/remake next}
\pgfplotsset{allDatasetsStackedXbar/.style=
{
xbar stacked=plus,
enlarge x limits=false,
bar width=6pt,
fill opacity=0.9,
xmin=0,
xmax=1,
xtick={0,.2,.4,.6,.8,1},
minor xtick={.1,.3,.5,.7,.9},
xminorgrids=true,
xmajorgrids=true,
% The number style seems to have stopped working?
xticklabel style={
/pgf/number format/fixed,
/pgf/number format/precision=2
},
ytick=data,
y dir=reverse,
yticklabel pos=right,
symbolic y coords={alexa.2014-09-01.random.10000-http,alexa.2014-09-01.random.10000-http-www,alexa.2014-09-01.random.10000-https,alexa.2014-09-01.random.10000-https-www,alexa.2014-09-01.top.10000-http,alexa.2014-09-01.top.10000-http-www,alexa.2014-09-01.top.10000-https,alexa.2014-09-01.top.10000-https-www,alexa.2014-09-01.top.dk.10000-http,alexa.2014-09-01.top.dk.10000-http-www,alexa.2014-09-01.top.dk.10000-https,alexa.2014-09-01.top.dk.10000-https-www,alexa.2014-09-01.top.se.10000-http,alexa.2014-09-01.top.se.10000-http-www,alexa.2014-09-01.top.se.10000-https,alexa.2014-09-01.top.se.10000-https-www,com.2014-08-29.random.10000-http,com.2014-08-29.random.10000-http-www,com.2014-08-29.random.10000-https,com.2014-08-29.random.10000-https-www,dk.2014-07-23.random.10000-http,dk.2014-07-23.random.10000-http-www,dk.2014-07-23.random.10000-https,dk.2014-07-23.random.10000-https-www,net.2014-08-29.random.10000-http,net.2014-08-29.random.10000-http-www,net.2014-08-29.random.10000-https,net.2014-08-29.random.10000-https-www,reach50.2014w35.se-http,reach50.2014w35.se-http-www,reach50.2014w35.se-https,reach50.2014w35.se-https-www,se.2014-07-10.random.100000-http,se.2014-07-10.random.100000-http-www,se.2014-07-10.random.100000-https,se.2014-07-10.random.100000-https-www,se.healthstatus.2013.counties-http,se.healthstatus.2013.counties-http-www,se.healthstatus.2013.counties-https,se.healthstatus.2013.counties-https-www,se.healthstatus.2013.domain-registrars-http,se.healthstatus.2013.domain-registrars-http-www,se.healthstatus.2013.domain-registrars-https,se.healthstatus.2013.domain-registrars-https-www,se.healthstatus.2013.financial-services-http,se.healthstatus.2013.financial-services-http-www,se.healthstatus.2013.financial-services-https,se.healthstatus.2013.financial-services-https-www,se.healthstatus.2013.gocs-http,se.healthstatus.2013.gocs-http-www,se.healthstatus.2013.gocs-https,se.healthstatus.2013.gocs-https-www,se.healthstatus.2013.higher-education-http,se.healthstatus.2013.higher-education-http-www,se.healthstatus.2013.higher-education-https,se.healthstatus.2013.higher-education-https-www,se.healthstatus.2013.isps-http,se.healthstatus.2013.isps-http-www,se.healthstatus.2013.isps-https,se.healthstatus.2013.isps-https-www,se.healthstatus.2013.media-http,se.healthstatus.2013.media-http-www,se.healthstatus.2013.media-https,se.healthstatus.2013.media-https-www,se.healthstatus.2013.municipalities-http,se.healthstatus.2013.municipalities-http-www,se.healthstatus.2013.municipalities-https,se.healthstatus.2013.municipalities-https-www,se.healthstatus.2013.public-authorities-http,se.healthstatus.2013.public-authorities-http-www,se.healthstatus.2013.public-authorities-https,se.healthstatus.2013.public-authorities-https-www},
legend image code/.code={%
\draw[#1] (0pt,-4pt) rectangle (8pt,4pt);
},
},
allDatasetsStackedXbarFullPage/.style=
{
enlarge y limits=0.006,
width=.6\textwidth,
height=1.4\textwidth,
font=\small
}
}
\pgfplotsset{datasetsCDF/.style=
{
xmin=0,
xmax=1,
ymin=0,
ymax=1,
grid=both,
xtick={0,.1,...,1.1},
ytick={0,.1,...,1.1},
enlargelimits=false,
% Marks 0% and 99%.
mark repeat=99,
legend pos=south east,
legend style={
cells={anchor=west},
},
},
datasetsCDFFullPage/.style=
{
width=\textwidth,
height=1.425\textwidth,
}
}