Show More
@@ -1,113 +1,113 | |||
|
1 | 1 | %% This is the automatic preamble used by IPython. Note that it does *not* |
|
2 |
%% include a documentclass declaration |
|
|
3 | %% document. | |
|
2 | %% include a documentclass declaration. The documentclass is added at runtime | |
|
3 | %% to the overall document. | |
|
4 | 4 | |
|
5 | 5 | \usepackage{amsmath} |
|
6 | 6 | \usepackage{amssymb} |
|
7 | 7 | \usepackage{graphicx} |
|
8 | 8 | \usepackage{ucs} |
|
9 | 9 | \usepackage[utf8x]{inputenc} |
|
10 | 10 | |
|
11 | 11 | % needed for markdown enumerations to work |
|
12 | 12 | \usepackage{enumerate} |
|
13 | 13 | |
|
14 | 14 | % Slightly bigger margins than the latex defaults |
|
15 | 15 | \usepackage{geometry} |
|
16 | 16 | \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm} |
|
17 | 17 | |
|
18 | 18 | % Define a few colors for use in code, links and cell shading |
|
19 | 19 | \usepackage{color} |
|
20 | 20 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
21 | 21 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} |
|
22 | 22 | \definecolor{darkgreen}{rgb}{.12,.54,.11} |
|
23 | 23 | \definecolor{myteal}{rgb}{.26, .44, .56} |
|
24 | 24 | \definecolor{gray}{gray}{0.45} |
|
25 | 25 | \definecolor{lightgray}{gray}{.95} |
|
26 | 26 | \definecolor{mediumgray}{gray}{.8} |
|
27 | 27 | \definecolor{inputbackground}{rgb}{.95, .95, .85} |
|
28 | 28 | \definecolor{outputbackground}{rgb}{.95, .95, .95} |
|
29 | 29 | \definecolor{traceback}{rgb}{1, .95, .95} |
|
30 | 30 | |
|
31 | 31 | % Framed environments for code cells (inputs, outputs, errors, ...). The |
|
32 | 32 | % various uses of \unskip (or not) at the end were fine-tuned by hand, so don't |
|
33 | 33 | % randomly change them unless you're sure of the effect it will have. |
|
34 | 34 | \usepackage{framed} |
|
35 | 35 | |
|
36 | 36 | % remove extraneous vertical space in boxes |
|
37 | 37 | \setlength\fboxsep{0pt} |
|
38 | 38 | |
|
39 | 39 | % codecell is the whole input+output set of blocks that a Code cell can |
|
40 | 40 | % generate. |
|
41 | 41 | |
|
42 | 42 | % TODO: unfortunately, it seems that using a framed codecell environment breaks |
|
43 | 43 | % the ability of the frames inside of it to be broken across pages. This |
|
44 | 44 | % causes at least the problem of having lots of empty space at the bottom of |
|
45 | 45 | % pages as new frames are moved to the next page, and if a single frame is too |
|
46 | % long to fit on a page, will completely stop latex from compiling the | |
|
46 | % long to fit on a page, it will completely stop latex from compiling the | |
|
47 | 47 | % document. So unless we figure out a solution to this, we'll have to instead |
|
48 | 48 | % leave the codecell env. as empty. I'm keeping the original codecell |
|
49 | 49 | % definition here (a thin vertical bar) for reference, in case we find a |
|
50 | 50 | % solution to the page break issue. |
|
51 | 51 | |
|
52 | 52 | %% \newenvironment{codecell}{% |
|
53 | 53 | %% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}% |
|
54 | 54 | %% \MakeFramed{\vspace{-0.5em}}} |
|
55 | 55 | %% {\unskip\endMakeFramed} |
|
56 | 56 | |
|
57 | 57 | % For now, make this a no-op... |
|
58 | 58 | \newenvironment{codecell}{} |
|
59 | 59 | |
|
60 | 60 | \newenvironment{codeinput}{% |
|
61 | 61 | \def\FrameCommand{\colorbox{inputbackground}}% |
|
62 | 62 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
63 | 63 | {\unskip\endMakeFramed} |
|
64 | 64 | |
|
65 | 65 | \newenvironment{codeoutput}{% |
|
66 | 66 | \def\FrameCommand{\colorbox{outputbackground}}% |
|
67 | 67 | \vspace{-1.4em} |
|
68 | 68 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
69 | 69 | {\unskip\medskip\endMakeFramed} |
|
70 | 70 | |
|
71 | 71 | \newenvironment{traceback}{% |
|
72 | 72 | \def\FrameCommand{\colorbox{traceback}}% |
|
73 | 73 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
74 | 74 | {\endMakeFramed} |
|
75 | 75 | |
|
76 | 76 | % Use and configure listings package for nicely formatted code |
|
77 | 77 | \usepackage{listingsutf8} |
|
78 | 78 | \lstset{ |
|
79 | 79 | language=python, |
|
80 | 80 | inputencoding=utf8x, |
|
81 | 81 | extendedchars=\true, |
|
82 | 82 | aboveskip=\smallskipamount, |
|
83 | 83 | belowskip=\smallskipamount, |
|
84 | 84 | xleftmargin=2mm, |
|
85 | 85 | breaklines=true, |
|
86 | 86 | basicstyle=\small \ttfamily, |
|
87 | 87 | showstringspaces=false, |
|
88 | 88 | keywordstyle=\color{blue}\bfseries, |
|
89 | 89 | commentstyle=\color{myteal}, |
|
90 | 90 | stringstyle=\color{darkgreen}, |
|
91 | 91 | identifierstyle=\color{darkorange}, |
|
92 | 92 | columns=fullflexible, % tighter character kerning, like verb |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | % The hyperref package gives us a pdf with properly built |
|
96 | 96 | % internal navigation ('pdf bookmarks' for the table of contents, |
|
97 | 97 | % internal cross-reference links, web links for URLs, etc.) |
|
98 | 98 | \usepackage{hyperref} |
|
99 | 99 | \hypersetup{ |
|
100 | 100 | breaklinks=true, % so long urls are correctly broken across lines |
|
101 | 101 | colorlinks=true, |
|
102 | 102 | urlcolor=blue, |
|
103 | 103 | linkcolor=darkorange, |
|
104 | 104 | citecolor=darkgreen, |
|
105 | 105 | } |
|
106 | 106 | |
|
107 | 107 | % hardcode size of all verbatim environments to be a bit smaller |
|
108 |
\makeatletter |
|
|
108 | \makeatletter | |
|
109 | 109 | \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt |
|
110 |
\makeatother |
|
|
110 | \makeatother | |
|
111 | 111 | |
|
112 | 112 | % Prevent overflowing lines due to urls and other hard-to-break entities. |
|
113 | 113 | \sloppy |
General Comments 0
You need to be logged in to leave comments.
Login now