-
Notifications
You must be signed in to change notification settings - Fork 32
/
html-settings.tex
78 lines (58 loc) · 2.15 KB
/
html-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
\usepackage[english]{babel}
%----------------------------------------
% 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}{}
% Asides
\newenvironment{aside}[1]{\begin{quote}\subsubsection*{#1}}{\end{quote}}
%----------------------------------------
% HTML tags.
\newcommand{\htmltag}[1]{\texttt{{\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}}
% 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]{\href{#1}{#2}}
% Always load hyperref last
% https://tex.stackexchange.com/questions/16268/warning-with-footnotes-namehfootnote-xx-has-been-referenced-but-does-not-exi
\usepackage{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}]}