-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmediabuilder.tex
174 lines (134 loc) · 5.21 KB
/
mediabuilder.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
% mediabuilder.tex is an external preamble that can be included in
% pandoc templates to improve the way tex templates are rendered
% This file contains a bunch of custom includes that I use across many tex
% templates
% Stuff added for pandoc
% ALGORITHMS -------------------------------------------------------------------
% These two packages are used to write algorithms
\usepackage{algorithm}
\usepackage{algpseudocode}
% HYPERLINKS -------------------------------------------------------------------
% Setting up hyperref so that links can be populated
\usepackage{ifxetex,ifluatex}
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex]{hyperref}
\else
\usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true, pdfborder={0 0 0}}
% FIGURES ----------------------------------------------------------------------
% used for wrapfig
\usepackage{wrapfig}
\usepackage{dblfloatfix}
% To handle multicolumn figures
% This lets you do \Begin{widefig}
\let\Begin\begin
\let\End\end
\newenvironment{widefig}{
\renewenvironment{figure}{\begin{figure*}\centering}{\end{figure*}}
\renewenvironment{table}{\begin{table*}\centering}{\end{table*}}
}
\newenvironment{widefigbot}{
\renewenvironment{figure}{\begin{figure*}[!b]\centering}{\end{figure*}}
\renewenvironment{table}{\begin{table*}\centering}{\end{table*}}
}
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Old way to do this:
% $if(graphics)$
% \usepackage{graphicx}
% % We will generate all images so they have a width \maxwidth. This means
% % that they will get their normal width if they fit onto the page, but
% % are scaled down if they would overflow the margins.
% \makeatletter
% \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
% \else\Gin@nat@width\fi}
% \makeatother
% \let\Oldincludegraphics\includegraphics
% \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
% $endif$
% When I was using the multicol environment, I had to redefine the figure
% environment so there's no float (what pandoc does by default)
% to make it compatible with the multicol package. This is how I did that.
% This led to several problems, such as figures showing up out-of-order. In the
% end, because of this, I abandoned the multicol package and switched back to
% the basic, builtin twocol environment. Leaving this here in case I ever need
% multicol again:
% \usepackage{float}
% \let\origfigure\figure
% \let\endorigfigure\endfigure
% \renewenvironment{figure}[1][2] {
% \expandafter\origfigure\expandafter[H]
% } {
% \endorigfigure
% }
% % Also for the table
% \let\origtable\table
% \let\endorigtable\endtable
% \renewenvironment{table}[1][2] {
% \expandafter\origtable\expandafter[H]
% } {
% \endorigtable
% }
% LISTS ----------------------------------------------------------------------
\let\tightlist\relax
% \providecommand{\tightlist}{
% \setlength{\itemsep}{0pt}
% \setlength{\parskip}{0pt}}
\providecommand{\tightlist}{
\setlength{\topsep}{1em}
\setlength{\partopsep}{1em}
\setlength{\parskip}{1em}
\setlength{\parsep}{1em}
\setlength{\parindent}{0pt}
\setlength{\itemsep}{0pt}
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
}
% make bullets smaller
\def\labelitemi{\raisebox{0.5ex}{\tiny\textbullet}}
% this itemindent code adjusts the indentation of bullet lists.
% Redefine labelwidth for lists; otherwise, the enumerate package will cause
% markers to extend beyond the left margin.
\makeatletter\AtBeginDocument{%
\renewcommand{\@listi}
{\setlength{\labelwidth}{4em}}
}\makeatother
\usepackage{enumerate}
% TABLES -----------------------------------------------------------------------
% longtable is required for markdown-format tables to be rendered in latex
\usepackage{longtable}
% LAYOUT -----------------------------------------------------------------------
\def\topfraction{0.9} % 90 percent of the page may be used by floats on top
\def\bottomfraction{0.9} % 90 percent of the page may be used by floats at the bottom
\clubpenalty=9996
\widowpenalty=9999
\brokenpenalty=4991
\predisplaypenalty=10000
\postdisplaypenalty=1549
\displaywidowpenalty=1602
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
% FONTS ---
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
% \renewcommand{\rmdefault}{bch} % Charter
% \renewcommand{\sfdefault}{bch} % Charter
% CSV INCLUDES ---
% for including csv files
\usepackage{tikz} % required to fix incompatibility with ctable: https://github.com/T-F-S/csvsimple/issues/9
\usepackage{csvsimple}
% for toprule and midrule
\usepackage{booktabs}
% formatting csv tables with 'catch-all' variable column widths
\usepackage{tabularx}