-
Notifications
You must be signed in to change notification settings - Fork 0
/
tex_utils_demo.tex
106 lines (89 loc) · 3.25 KB
/
tex_utils_demo.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
%!TEX program = xelatex
\documentclass{article}
\usepackage{parskip}
% Pass these options to biblatex when/if it's loaded.
\PassOptionsToPackage{%
natbib=true,backend=biber,sorting=nymdt,%
citestyle=authoryear,bibstyle=authoryear,%
url=false,doi=false,isbn=false,%
backref%
}{biblatex}
% jbib_links: makes nice links, and defines nymdt sorting.
% Imports biblatex, mathtools, xcolor, hyperref, cleveref.
\input{/Users/j/Library/texmf/custom/jbib_links.tex}
% I'll add in an inline citation. Would normally be an external file.
% note that the url field is used to link the title, but doesn't show up
% in the citation as text. Same for a doi.
\begin{filecontents}[overwrite]{\jobname-refs.bib}
@book{mackay.d:2003,
author = {MacKay, David J. C.},
publisher = {Cambridge university press},
title = {Information theory, inference and learning algorithms},
url = {https://www.inference.org.uk/itila/},
year = {2003}
}
@inproceedings{harremoes.p:2007,
author = {Harremo{\"e}s, Peter and Tishby Naftali},
booktitle = {2007 IEEE International Symposium on Information Theory},
doi = {10.1109/ISIT.2007.4557285},
pages = {566--570},
title = {The information bottleneck revisited or how to choose a good
distortion measure},
year = {2007}
}
@article{schwartz.m:2008,
title = {The Importance of Stupidity in Scientific Research},
author = {Schwartz, Martin A.},
year = {2008},
month = jun,
journal = {Journal of Cell Science},
volume = {121},
number = {11},
pages = {1771},
issn = {0021-9533},
doi = {10.1242/jcs.033340}
}
@article{upper.d:1974,
title = {The Unsuccessful Self-Treatment of a Case of ``Writer's Block''},
author = {Upper, Dennis},
year = {1974},
journal = {Journal of Applied Behavior Analysis},
volume = {7},
number = {3},
pages = {497--497},
doi = {10.1901/jaba.1974.7-497a},
}
}
\end{filecontents}
\addbibresource{\jobname-refs.bib}
% jformat: defines \myuline for nicer underline.
% Imports packages contour, ulem
\input{/Users/j/Library/texmf/custom/jformat.tex}
% kast: a nice box environment:
\input{/Users/j/Library/texmf/custom/kast.tex}
% IT operators: for expectation \E{}, entropy \H{}, MI \I{} etc.
\input{/Users/j/Library/texmf/custom/information-theory-operators.tex}
\begin{document}
\title{Some \LaTeX\ utils}
\author{jlh}
\maketitle
This document demos some things I've collected for nicer texing.
For instance, underlines like this \myuline{example}.
Also, citations with auto links, like this: check out
the link in the refences when I cite, e.g.~\citet[][]{mackay.d:2003,
harremoes.p:2007,schwartz.m:2008,upper.d:1974}.
Links are auto-generated from the \texttt{url}, \texttt{doi}, etc.\ fields.
\begin{kast}{Simple titled box}
For a box like this, use the \texttt{kast} environment.
\end{kast}
Information theory operators, for things like this:
\begin{align}
\I{X;Y} &= \KL{P_{(X,Y)}}{P_X \otimes P_Y}
&&= \E_{p_{(X,Y)}}{\log \frac{p_{(X,Y)}(x,y)}{p_X(x)p_Y(y)}}\\
&= \H{X} - \H{X\mid Y}\\
& &&= \int_{\mathcal{X}\times\mathcal{Y}}
\log \mleft(\frac{\mathrm{d}P_X \otimes
P_Y}{\mathrm{d}P_{(X,Y)}}\mright) \,\mathrm{d}P_X \otimes P_Y
\end{align}
\printbibliography{}
\end{document}