-
Notifications
You must be signed in to change notification settings - Fork 32
/
pdf-settings.tex
172 lines (137 loc) · 4.83 KB
/
pdf-settings.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
\usepackage{fix-cm}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{makeidx}
\usepackage{multicol}
\usepackage{inputenc}
\usepackage{epigrafica}
\usepackage[LGR,OT1]{fontenc}
\usepackage{mathptmx}
\usepackage{changepage}
\usepackage[center]{caption}
\usepackage{float}
\hfuzz=30pt % Don't bother to report over-full boxes < 10pt
\vfuzz=30pt % Don't bother to report over-full boxes < 10pt
\setlength{\paperheight}{11in}
% Use numbers for nested lists all the way down.
\usepackage{enumitem}
\setlist[enumerate,1]{label=\arabic*., ref=\arabic*}
\setlist[enumerate,2]{label=\arabic*., ref=\arabic*}
\setlist[enumerate,3]{label=\arabic*., ref=\arabic*}
% Make description items cross-referenceable
\def\namedlabel#1#2{\begingroup
#2%
\def\@currentlabel{#2}%
\phantomsection\label{#1}\endgroup
}
\makeatother
% Change hanging indentation for description environment.
\makeatletter
\renewenvironment{description}%
{\list{}{\leftmargin=1em\itemsep3pt % <------- Adjust this length
\labelwidth\z@ \itemindent-\leftmargin
\let\makelabel\descriptionlabel}}%
{\endlist}
\makeatother
% Use smaller font for verbatim environments.
\usepackage{fancyvrb}
% Syntax highlighting with minted <http://mirror.its.dal.ca/ctan/macros/latex/contrib/minted/minted.pdf>
% Change font size for code blocks. <https://tex.stackexchange.com/questions/406862/different-fontsize-for-minted-and-mintinline?rq=1>
\usepackage{minted}
\setminted{fontsize=\footnotesize}
\setmintedinline{fontsize=\footnotesize}
\frenchspacing
\tolerance=5000
% Ignore subtitle in PDF version.
\newcommand{\subtitle}[1]{}
% Create an index.
\makeindex
% Remove indentation from footnotes
\usepackage[hang,flushmargin]{footmisc}
%----------------------------------------
% Allow multi-page tables.
\usepackage{longtable}
% Mark recommendations.
\newcommand{\recommendation}[1]{\emph{#1}}
\usepackage[T1]{fontenc}
% Bibliography.
\usepackage[backend=biber,style=alphabetic,sorting=nyt,maxbibnames=99]{biblatex}
\addbibresource{book.bib}
% https://tex.stackexchange.com/questions/8428/use-bibtex-key-as-the-cite-key
\DeclareFieldFormat{labelalpha}{\thefield{entrykey}}
\DeclareFieldFormat{extraalpha}{}
\setlength{\biblabelsep}{\labelsep}% <-- adjust this to your liking, the standard is 2\labelsep
\defbibenvironment{bibliography}
{\addcontentsline{toc}{chapter}{\bfseries References}\list
{\printtext[labelalphawidth]{%
\printfield{prefixnumber}%
\printfield{labelalpha}%
\printfield{extraalpha}}}
{\setlength{\labelsep}{\biblabelsep}%
\setlength{\leftmargin}{24pt}%\labelsep
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\bf##1\hss}}
{\endlist}
{\item}
\bibparsep3pt
\usepackage{csquotes}
\def\UrlFont{\rmfamily}
% Asides
\newenvironment{aside}[1]%
{\addvspace{6pt}\begin{adjustwidth}{2em}{2em}%
\centerline{\itshape\textbf{#1}}\par\itshape\noindent\ignorespaces}%
{\end{adjustwidth}\addvspace{6pt}}
%----------------------------------------
% HTML tags.
\newcommand{\htmltag}[1]{{\textless}{#1}{\textgreater}}
% Chapters, sections, and appendices with labels.
\newcommand{\appref}[1]{Appendix~\ref{#1}}
\newcommand{\chapref}[1]{Chapter~\ref{#1}}
\newcommand{\figref}[1]{Figure~\ref{#1}}
\newcommand{\secref}[1]{Section~\ref{#1}}
\newcommand{\tblref}[1]{Table~\ref{#1}}
% Always put \label after \caption.
\newcommand{\caplbl}[2]{\caption{{#1}\label{#2}}}
% Image figures.
\newcommand{\figimg}[3]{\begin{figure}%
\centering%
\includegraphics[width=\textwidth]{#1}%
\caplbl{#2}{#3}%
\end{figure}}
% Image figures with scale (for screenshots).
\newcommand{\figimgscale}[4]{\begin{figure}%
\centering%
\includegraphics[scale=#4]{#1}%
\caplbl{#2}{#3}%
\end{figure}}
% PDF figures.
\newcommand{\figpdf}[3]{\begin{figure}%
\centering%
\includegraphics[scale=0.6]{#1}%
\caplbl{#2}{#3}%
\end{figure}}
% PDF figures forcing location.
\newcommand{\figpdfhere}[3]{\begin{figure}[H]%
\centering%
\includegraphics[scale=0.6]{#1}%
\caplbl{#2}{#3}%
\end{figure}}
% Exercise headings.
\newcommand{\exercise}[1]{\subsection*{#1}}
%----------------------------------------
% Render hyperlinks with footnotes as well.
\newcommand{\hreffoot}[2]{{#2}\footnote{\href{#1}{#1}}}
% Always load hyperref last
% https://tex.stackexchange.com/questions/16268/warning-with-footnotes-namehfootnote-xx-has-been-referenced-but-does-not-exi
\usepackage{hyperref}
%%\usepackage[plainpages=false,pdfpagelabels,pagebackref]{hyperref}
%----------------------------------------
% Glossary references and items have to come after hyperref package.
\newcommand{\gref}[2]{\hyperlink{#1}{\textbf{#2}}\index{#2}}
\newcommand{\grefdex}[3]{\hyperlink{#1}{\textbf{#2}}\index{#3}}
\newcommand{\grefcross}[2]{\hyperlink{#1}{\textbf{#2}}}
\newcommand{\gitem}[2]{\item[\hypertarget{#1}{#2}:]}