-
Notifications
You must be signed in to change notification settings - Fork 15
/
btp.sty
575 lines (529 loc) · 16.7 KB
/
btp.sty
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
% The Bioinformatics Training Platform Style
%
\let\footruleskip\undefined % see http://tex.stackexchange.com/questions/37868/fancyhdr-and-memoir
\usepackage{fancyhdr} % For headers and footers
\usepackage{listings} % Required for insertion of code
\usepackage{courier} % Required for the courier font
\usepackage[usenames,dvipsnames]{color} % Required for custom colors
\usepackage[table]{xcolor}
\usepackage[pdftex]{graphicx}
\usepackage{hyperref}
\usepackage{fullpage} % See http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Manual_Page_Formatting for layout
\usepackage{enumitem}
\linespread{1.0} % Line spacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.2cm}
\usepackage{mdframed}
\usepackage{etoolbox}
\usepackage[nobottomtitles]{titlesec}
\usepackage[section]{placeins}
\usepackage{ifthen}
\usepackage{array}
% packages for Creative Commons Licences
\usepackage{xmpincl}
\includexmp{licences/CC_Attribution_3.0_Unported} % includes XML metadata into the PDF
\usepackage{microtype}
\usepackage{accsupp}
\usepackage{textcomp}
\usepackage{float}
\usepackage{lmodern} % to ensure most charaters in listings and texttt are copy-paste safe and print nicely
\usepackage{comment}
\newtoggle{trainermanual} % defaults to false
\newcommand{\workshopTitle}{Example Workshop Title}
\newcommand{\workshopVenue}{Example Location, Earth}
\newcommand{\workshopDate}{MMM. YYYY}
\newcommand{\workshopAuthor}{
Example Workshop Author, Contributers etc\\
}
%%%%%%%%%%
%%%%%%%%%%
\DeclareOption{trainermanual}{\settoggle{trainermanual}{true}}
\ProcessOptions
%%%%%%%%%%
%%%%%%%%%%
\raggedbottom % put all vertical white space at the bottom of the page
\newlength{\defparskip}
\setlength{\defparskip}{0.5cm}
\specialcomment{answer}{\begingroup\color{red}}{\endgroup}
\newlength{\descriptionlabelspace}
\setlength{\descriptionlabelspace}{5.5cm}
% config display of hyperlinks
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=blue % color of external links
}
\definecolor{darkgreen}{rgb}{0,0.9,0}
\newcommand{\noncopytext}[1]{%
\BeginAccSupp{method=escape,ActualText={}}%
#1%
\EndAccSupp{}%
}
% set the default style for lstlisting environments
\lstset{ %
% language=sh, % the language of the code
columns=fullflexible,
upquote=true,
aboveskip=5pt,
belowskip=10pt,
basicstyle=\small\ttfamily, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\tiny\color{black!85}\noncopytext, % the style that is used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1, each line
% % will be numbered
numbersep=13pt, % how far the line-numbers are from the code. Add framesep value to this
backgroundcolor=\color{black!5}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
xleftmargin=20pt,
xrightmargin=10pt,
framesep=5pt,
framerule=3pt,
frame=leftline, % adds a frame around the code
rulecolor=\color{darkgreen}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
tabsize=2, % sets default tabsize to 2 spaces
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
breakindent=20pt,
breakautoindent=true,
prebreak=\small\symbol{'134},
literate=%{*}{{\textasteriskcentered}}{1}
{~}{{\texttildelow}}{1} % reformat the high tilde to a normal tile which looks good for printing and is copy-and-pastable
%{-}{{\textminus}}{1},
}
% Define a styling for commandline syntax
% http://publib.boulder.ibm.com/tividd/td/TRM/GC32-1320-00/en_US/HTML/cmdref19.htm
\definecolor{darkred}{rgb}{0.9,0,0}
\lstdefinestyle{command_syntax}{
numbers=none,
rulecolor=\color{darkred},
sensitive=false,
alsoletter={.},
moredelim=[s][\color{red}]{<}{>},
moredelim=[s][\color{blue}]{[}{]},
moredelim=[is][\color{orange}]{:}{:},
keywords=[10]{...},
keywordstyle=[10]{\color{magenta}}
}
% Define the R language styling
\lstdefinestyle{R}{
rulecolor=\color{blue}, % if not set, the frame-color may be
% changed
}
% disables chapter, section and subsection numbering
% and number figures and tables consecutively throughout the document
\setcounter{secnumdepth}{-1}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
% This allows stuff on the same line to be vertically centered with respect of each other
\def\vcent#1{\mathsurround0pt$\vcenter{\hbox{#1}}$}
\def\vtp#1{\mathsurround0pt$\vtop{\hbox{#1}}$}
% config ...
\setlength{\topskip}{0.75cm}
\definecolor{warningshade}{rgb}{1,0.85,0.85}
\definecolor{questionshade}{rgb}{1,0.95,0.85}
\definecolor{bonusshade}{rgb}{0.92,1,0.92}
\definecolor{advancedshade}{rgb}{0.92,0.92,1}
% defaine a default style for the mdframed-based environments
% TODO Figure out how to apply the default style as the basis for other styles
\global\mdfdefinestyle{default}{
leftmargin=0pt,
skipabove=5pt,
rightmargin=0pt,
skipbelow=10pt,
%splittopskip=0pt,
%splitbottomskip=0pt,
innermargin=0pt,
outermargin=0pt,
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
leftline=false,
topline=false,
rightline=false,
bottomline=false,
linecolor=black,
linewidth=1pt,
roundcorner=5pt,
}
\global\mdfdefinestyle{warningbox}{
leftmargin=0pt,
skipabove=5pt,
rightmargin=0pt,
skipbelow=10pt,
%splittopskip=0pt,
%splitbottomskip=0pt,
innermargin=0pt,
outermargin=0pt,
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
leftline=false,
topline=false,
rightline=false,
bottomline=false,
linecolor=black,
linewidth=1pt,
roundcorner=5pt,
backgroundcolor=warningshade,
leftline=true,
topline=true,
rightline=true,
bottomline=true,
innerleftmargin=10pt,
innerrightmargin=10pt,
innertopmargin=10pt,
innerbottommargin=10pt,
nobreak=true,
}
\global\mdfdefinestyle{questionsbox}{
leftmargin=0pt,
skipabove=5pt,
rightmargin=0pt,
skipbelow=10pt,
%splittopskip=0pt,
%splitbottomskip=0pt,
innermargin=0pt,
outermargin=0pt,
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
leftline=false,
topline=false,
rightline=false,
bottomline=false,
linecolor=black,
linewidth=1pt,
roundcorner=5pt,
backgroundcolor=questionshade,
leftline=true,
topline=true,
rightline=true,
bottomline=true,
innerleftmargin=10pt,
innerrightmargin=10pt,
innertopmargin=10pt,
innerbottommargin=10pt,
skipabove=15pt,
skipbelow=20pt,
nobreak=true,
}
\global\mdfdefinestyle{bonusbox}{
leftmargin=0pt,
skipabove=5pt,
rightmargin=0pt,
skipbelow=10pt,
%splittopskip=0pt,
%splitbottomskip=0pt,
innermargin=0pt,
outermargin=0pt,
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
leftline=false,
topline=false,
rightline=false,
bottomline=false,
linecolor=black,
linewidth=1pt,
roundcorner=5pt,
% backgroundcolor=bonusshade,
leftline=true,
topline=true,
rightline=true,
bottomline=true,
innerleftmargin=10pt,
innerrightmargin=10pt,
innertopmargin=10pt,
innerbottommargin=10pt,
skipabove=15pt,
skipbelow=20pt,
nobreak=false, % these could span multiple pages, so we should let them break across pages
}
\global\mdfdefinestyle{advancedbox}{
leftmargin=0pt,
skipabove=5pt,
rightmargin=0pt,
skipbelow=10pt,
%splittopskip=0pt,
%splitbottomskip=0pt,
innermargin=0pt,
outermargin=0pt,
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
leftline=false,
topline=false,
rightline=false,
bottomline=false,
linecolor=black,
linewidth=1pt,
roundcorner=5pt,
% backgroundcolor=advancedshade,
leftline=true,
topline=true,
rightline=true,
bottomline=true,
innerleftmargin=10pt,
innerrightmargin=10pt,
innertopmargin=10pt,
innerbottommargin=10pt,
skipabove=15pt,
skipbelow=20pt,
nobreak=false, % these could span multiple pages, so we should let them break across pages
}
\newlength{\iconspacinglength}
\setlength{\iconspacinglength}{0.5cm}
\newcommand{\iconspacing}{\iconspacinglength}
\newlength{\questionspacing}
\setlength{\questionspacing}{2cm}
\newenvironment{steps}{%
\begin{mdframed}[style=default]%
%\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
%\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
\makebox[0pt][r]{\smash{\raisebox{-.6\height}{%
\includegraphics[height=1cm]{./graphics/steps.png}%
\hspace{\iconspacinglength}%
}}}\ignorespaces%
}%
{%
\end{mdframed}%
}
\newenvironment{bonus}{%
\begin{mdframed}[style=bonusbox]%
\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
%\newpage%
\makebox[0pt][r]{\smash{\raisebox{-.6\height}{%
\includegraphics[height=1cm]{./graphics/bonus1.png}%
\hspace{\iconspacinglength}%
}%
}%
}\ignorespaces%\vspace{-3em}\vspace{-\parskip}%
}%
{%
\end{mdframed}%
}
\newenvironment{advanced}{%
\begin{mdframed}[style=advancedbox]%
\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
%\newpage%
\makebox[0pt][r]{\smash{\raisebox{-.6\height}{%
\includegraphics[height=1cm]{./graphics/bonus2.png}%
\hspace{\iconspacinglength}%
}%
}%
}\ignorespaces%\vspace{-3em}%
}%
{%
\end{mdframed}%
}
\newenvironment{information}{%
\begin{mdframed}[style=default]%
%\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
%\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
\makebox[0pt][r]{\smash{\raisebox{-.6\height}{%
\includegraphics[height=1cm]{./graphics/info.png}%
\hspace{\iconspacinglength}%
}}}\ignorespaces%
}%
{%
\end{mdframed}%
}
\newenvironment{note}{%
\begin{mdframed}[style=default]%
%\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
%\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
\makebox[0pt][r]{\smash{\raisebox{-.6\height}{%
\includegraphics[height=1cm]{./graphics/notes.png}%
\hspace{\iconspacinglength}%
}}}\ignorespaces%
}%
{%
\end{mdframed}%
}
\newenvironment{warning}{%
\begin{mdframed}[style=warningbox]%
\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
\makebox[0pt][r]{\smash{\raisebox{-.25\height}{%
\includegraphics[height=1cm]{./graphics/warning.png}%
\hspace{\iconspacinglength}%
}}}\ignorespaces%
}%
{%
\end{mdframed}%
}
\newenvironment{questions}{%
\begin{mdframed}[style=questionsbox]%
\nottoggle{trainermanual}{\setlength{\parskip}{\questionspacing}}{}%
\addtolength{\iconspacinglength}{\mdflength{leftmargin}}%
\addtolength{\iconspacinglength}{\mdflength{innerleftmargin}}%
\makebox[0pt][r]{\smash{\raisebox{-.25\height}{%
\includegraphics[height=1cm]{./graphics/questions.png}%
\hspace{\iconspacinglength}%
}}}\ignorespaces%
}%
{%
\nottoggle{trainermanual}{\vspace{\questionspacing}}{}%
\end{mdframed}%
}
\definecolor{trainerfrontpageshade}{rgb}{1,0.9,0.9}
\newcommand{\trainermanualtext}{\huge\textbf{\textcolor{red}{TRAINER'S MANUAL}}}
\newcommand{\workshoptitlepage}{
\thispagestyle{plain}
\iftoggle{trainermanual}{
\pagecolor{trainerfrontpageshade}
}{}
\noindent
\begin{center}
\rule{\textwidth}{1pt}
\vspace*{\fill}
{\Huge\workshopTitle}
\vspace{2cm}
\workshopAuthor
\vfill
\rule{\textwidth}{1pt}
\begin{minipage}{0.45\textwidth}
\begin{flushleft}
\workshopVenue
\end{flushleft}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\begin{flushright}
\workshopDate
\end{flushright}
\end{minipage}
\rule{\textwidth}{1pt}
\end{center}
\clearpage
\iftoggle{trainermanual}{
\pagecolor{white}%
}{}
}
%TODO Revise this chapter styling code, there appears to be a couple of things wrong with it.
\makechapterstyle{workshop}{%
\chapterstyle{default}
\renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
\renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
\settowidth{\chapindent}{\chapnumfont 111}
\renewcommand*{\chapterheadstart}{\begingroup
%\vspace*{\beforechapskip}%
\begin{adjustwidth}{}{-\chapindent}%
\hrulefill
\smash{\rule{0.4pt}{15mm}}
\end{adjustwidth}\endgroup}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\printchapternum}{%
\begin{adjustwidth}{}{-\chapindent}
\hfill
\raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
\hspace*{1em}
\end{adjustwidth}\vspace*{-3.0\onelineskip}}
\renewcommand*{\printchaptertitle}[1]{%
\vskip\onelineskip
\raggedleft {\chaptitlefont ##1}\par\nobreak}
}
\makechapterstyle{module}{%
\chapterstyle{workshop}
\renewcommand*{\printchaptertitle}[1]{%
\vskip\onelineskip
\raggedleft {\chaptitlefont Module: ##1}\par\nobreak
\vfill
Primary Author(s):\par
\moduleAuthors\par
\vspace{1cm}
Contributor(s):\par
\moduleContributions}\par
}
\aliaspagestyle{chapter}{empty}
\newcommand{\mailto}[1]{
\href{mailto:#1}{\nolinkurl{#1}}
}
\newcommand{\moduleTitle}{}
\newcommand{\moduleAuthors}{}
\newcommand{\moduleContributions}{}
\newcommand{\setModuleTitle}[1]{\renewcommand{\moduleTitle}{#1}}
\newcommand{\setModuleAuthors}[1]{\renewcommand{\moduleAuthors}{#1}}
\newcommand{\setModuleContributions}[1]{\renewcommand{\moduleContributions}{#1}}
%\newcolumntype{V}{>{\centering\arraybackslash} m{3cm} }
% set default headers footers
\pagestyle{fancy}
\setlength{\headheight}{15pt}
\fancyhead[LE,RO]{\slshape \nouppercase{\leftmark}}
\fancyhead[LO,RE]{\slshape \nouppercase{\rightmark}}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[C]{\includegraphics[height=0.75cm]{./licences/cc_by.png}}
\addtolength{\headsep}{\baselineskip}
\iftoggle{trainermanual}{
\fancyfoot[C]{\trainermanualtext}
}{}
% define the plain page style for both trainee and trainer's manual
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrulewidth}{0pt}
}
\iftoggle{trainermanual}{
\fancypagestyle{plain}{%
\fancyhf{}
\fancyhead[C]{\trainermanualtext}
\fancyfoot[C]{\trainermanualtext}
\renewcommand{\headrulewidth}{0pt}
}{}
}
\title{\workshopTitle}
\date{\workshopDate}
\author{\workshopAuthor}
\nottoggle{trainermanual}{
\excludecomment{answer}
}{}
%\includeonly{workshop_preamble.tex,rna-seq.tex}
\chapterstyle{workshop}
% Code for making a page run of ruled lines. From:
% http://tex.stackexchange.com/a/79018/19412
% Defines \myruledpage command with two mandatory arguments; the first one gives
% the length of the first column of rules, and the second one controls the
% separation between rules;
\makeatletter
% Code taken from exam.cls and modified
\newlength\linefillheight
\newlength\linefillthickness
\setlength\linefillheight{.25in}
\setlength\linefillthickness{0.1pt}
\newcommand\linefill[1]{\leavevmode
\rule{#1}{\linefillthickness}\ \leaders\hrule height \linefillthickness \hfill\kern\z@}
\newcommand\fillwithlines[2]{%
\begingroup
\ifhmode
\par
\fi
\hrule height \z@
\nobreak
\setbox0=\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \linefillheight depth \z@ width \z@
\linefill{#2}}%
% We use \cleaders (rather than \leaders) so that a given
% vertical space will always produce the same number of lines
% no matter where on the page it happens to start:
\cleaders \copy0 \vskip #1 \hbox{}%
\endgroup
}
\makeatother
\newcommand\myruledpage[2]{%
\setlength\linefillheight{#2}
\fillwithlines{\stretch{1}}{#1}
\newpage}
\newcommand{\setWorkshopTitle}[1]{\renewcommand{\workshopTitle}{#1}}
\newcommand{\setWorkshopVenue}[1]{\renewcommand{\workshopVenue}{#1}}
\newcommand{\setWorkshopDate}[1]{\renewcommand{\workshopDate}{#1}}
\newcommand{\setWorkshopAuthor}[1]{\renewcommand{\workshopAuthor}{#1}}