Show More
@@ -1,98 +1,112 b'' | |||
|
1 | 1 | %% This is the automatic preamble used by IPython. Note that it does *not* |
|
2 | 2 | %% include a documentclass declaration, that is added at runtime to the overall |
|
3 | 3 | %% 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 | \newenvironment{codecell}{% | |
|
42 | \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}% | |
|
43 | \MakeFramed{\vspace{-0.5em}\FrameRestore}} | |
|
44 | {\unskip\endMakeFramed} | |
|
41 | ||
|
42 | % TODO: unfortunately, it seems that using a framed codecell environment breaks | |
|
43 | % the ability of the frames inside of it to be broken across pages. This | |
|
44 | % causes at least the problem of having lots of empty space at the bottom of | |
|
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 | |
|
47 | % document. So unless we figure out a solution to this, we'll have to instead | |
|
48 | % leave the codecell env. as empty. I'm keeping the original codecell | |
|
49 | % definition here (a thin vertical bar) for reference, in case we find a | |
|
50 | % solution to the page break issue. | |
|
51 | ||
|
52 | %% \newenvironment{codecell}{% | |
|
53 | %% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}% | |
|
54 | %% \MakeFramed{\vspace{-0.5em}}} | |
|
55 | %% {\unskip\endMakeFramed} | |
|
56 | ||
|
57 | % For now, make this a no-op... | |
|
58 | \newenvironment{codecell}{} | |
|
45 | 59 | |
|
46 | 60 | \newenvironment{codeinput}{% |
|
47 | 61 | \def\FrameCommand{\colorbox{inputbackground}}% |
|
48 | 62 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
49 | 63 | {\unskip\endMakeFramed} |
|
50 | 64 | |
|
51 | 65 | \newenvironment{codeoutput}{% |
|
52 | 66 | \def\FrameCommand{\colorbox{outputbackground}}% |
|
53 | 67 | \vspace{-1.4em} |
|
54 | 68 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
55 | 69 | {\unskip\medskip\endMakeFramed} |
|
56 | 70 | |
|
57 | 71 | \newenvironment{traceback}{% |
|
58 | 72 | \def\FrameCommand{\colorbox{traceback}}% |
|
59 | 73 | \MakeFramed{\advance\hsize-\width \FrameRestore}} |
|
60 | 74 | {\endMakeFramed} |
|
61 | 75 | |
|
62 | 76 | % Use and configure listings package for nicely formatted code |
|
63 | 77 | \usepackage{listingsutf8} |
|
64 | 78 | \lstset{ |
|
65 | 79 | language=python, |
|
66 | 80 | inputencoding=utf8x, |
|
67 | 81 | extendedchars=\true, |
|
68 | 82 | aboveskip=\smallskipamount, |
|
69 | 83 | belowskip=\smallskipamount, |
|
70 | 84 | %xleftmargin=3mm, |
|
71 | 85 | breaklines=true, |
|
72 | 86 | basicstyle=\small \ttfamily, |
|
73 | 87 | showstringspaces=false, |
|
74 | 88 | keywordstyle=\color{blue}\bfseries, |
|
75 | 89 | commentstyle=\color{myteal}, |
|
76 | 90 | stringstyle=\color{darkgreen}, |
|
77 | 91 | identifierstyle=\color{darkorange}, |
|
78 | 92 | } |
|
79 | 93 | |
|
80 | 94 | % The hyperref package gives us a pdf with properly built |
|
81 | 95 | % internal navigation ('pdf bookmarks' for the table of contents, |
|
82 | 96 | % internal cross-reference links, web links for URLs, etc.) |
|
83 | 97 | \usepackage{hyperref} |
|
84 | 98 | \hypersetup{ |
|
85 | 99 | breaklinks=true, % so long urls are correctly broken across lines |
|
86 | 100 | colorlinks=true, |
|
87 | 101 | urlcolor=blue, |
|
88 | 102 | linkcolor=darkorange, |
|
89 | 103 | citecolor=darkgreen, |
|
90 | 104 | } |
|
91 | 105 | |
|
92 | 106 | % hardcode size of all verbatim environments to be a bit smaller |
|
93 | 107 | \makeatletter |
|
94 | 108 | \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt |
|
95 | 109 | \makeatother |
|
96 | 110 | |
|
97 | 111 | % Prevent overflowing lines due to urls and other hard-to-break entities. |
|
98 | 112 | \sloppy |
General Comments 0
You need to be logged in to leave comments.
Login now