##// END OF EJS Templates
Merge pull request #3578 from jakobgager/latex_image_handle...
Min RK -
r11252:0e65ed03 merge
parent child Browse files
Show More
@@ -1,263 +1,266 b''
1 1 ((*- extends 'display_priority.tplx' -*))
2 2
3 3 ((* block in_prompt *))((* endblock in_prompt *))
4 4
5 5 ((* block output_prompt *))((* endblock output_prompt *))
6 6
7 7 ((* block codecell *))\begin{codecell}((( super() )))
8 8 \end{codecell}
9 9 ((* endblock *))
10 10
11 11 ((* block input *))
12 12 \begin{codeinput}
13 13 \begin{lstlisting}
14 14 ((( cell.input )))
15 15 \end{lstlisting}
16 16 \end{codeinput}
17 17 ((* endblock input *))
18 18
19 19
20 20 ((= Those Two are for error displaying
21 21 even if the first one seem to do nothing,
22 22 it introduces a new line
23 23
24 24 =))
25 25 ((* block pyerr *))
26 26 \begin{traceback}
27 27 \begin{verbatim}((( super() )))
28 28 \end{verbatim}
29 29 \end{traceback}
30 30 ((* endblock pyerr *))
31 31
32 32 ((* block traceback_line *))
33 33 ((( line |indent| rm_ansi )))((* endblock traceback_line *))
34 34 ((= .... =))
35 35
36 36
37 37 ((*- block output_group -*))
38 38 \begin{codeoutput}
39 39 ((( super() )))
40 40 \end{codeoutput}((* endblock *))
41 41
42 42 ((*- block data_png -*))
43 43 \begin{center}
44 \includegraphics[width=0.7\textwidth, height=0.9\textheight, keepaspectratio]{(((output.key_png)))}
44 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.key_png)))}
45 45 \par
46 46 \end{center}
47 47 ((*- endblock -*))
48 48
49 49 ((*- block data_jpg -*))
50 50 \begin{center}
51 \includegraphics[width=0.7\textwidth, height=0.9\textheight, keepaspectratio]{(((output.key_jpeg)))}
51 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.key_jpeg)))}
52 52 \par
53 53 \end{center}
54 54 ((*- endblock -*))
55 55
56 56 ((*- block data_svg -*))
57 57 \begin{center}
58 58 \includegraphics[width=0.7\textwidth]{(((output.key_svg)))}
59 59 \par
60 60 \end{center}
61 61 ((*- endblock -*))
62 62
63 63 ((* block pyout *))
64 64 ((* block data_priority scoped *))((( super() )))((* endblock *))
65 65 ((* endblock pyout *))
66 66
67 67 ((* block data_text *))
68 68 \begin{verbatim}
69 69 ((( output.text )))
70 70 \end{verbatim}
71 71 ((* endblock *))
72 72
73 73 ((* block data_latex -*))
74 74 ((*- if output.latex.startswith('$'): -*)) \begin{equation*}
75 75 ((( output.latex | rm_dollars)))
76 76 \end{equation*}
77 77 ((*- else -*)) ((( output.latex ))) ((*- endif *))
78 78 ((* endblock *))
79 79
80 80 ((* block stream *))
81 81 \begin{Verbatim}[commandchars=\\\{\}]
82 82 ((( output.text | ansi2latex)))
83 83 \end{Verbatim}
84 84 ((* endblock stream *))
85 85
86 86 ((* block markdowncell scoped *))((( cell.source | markdown2latex )))
87 87 ((* endblock markdowncell *))
88 88
89 89 ((* block headingcell scoped -*))
90 90 \
91 91 ((*- if cell.level == 1 -*))
92 92 ((* block h1 -*))section((* endblock h1 -*))
93 93 ((*- elif cell.level == 2 -*))
94 94 ((* block h2 -*))subsection((* endblock h2 -*))
95 95 ((*- elif cell.level == 3 -*))
96 96 ((* block h3 -*))subsubsection((* endblock h3 -*))
97 97 ((*- elif cell.level == 4 -*))
98 98 ((* block h4 -*))paragraph((* endblock h4 -*))
99 99 ((*- elif cell.level == 5 -*))
100 100 ((* block h5 -*))subparagraph((* endblock h5 -*))
101 101 ((*- elif cell.level == 6 -*))
102 102 ((* block h6 -*))subparagraph((* endblock h6 -*))
103 103 ((= 6th level not available in standard latex =))
104 104
105 105 ((*- endif -*)){((( cell.source | markdown2latex )))}
106 106 ((* endblock headingcell *))
107 107
108 108 ((* block rawcell scoped *))
109 109 ((( cell.source | pycomment )))
110 110 ((* endblock rawcell *))
111 111
112 112 ((* block unknowncell scoped *))
113 113 unknown type (((cell.type)))
114 114 ((* endblock unknowncell *))
115 115
116 116
117 117
118 118 ((* block body *))
119 119
120 120 ((* block bodyBegin *))
121 121 \begin{document}
122 122 ((* endblock bodyBegin *))
123 123
124 124 ((( super() )))
125 125
126 126 ((* block bodyEnd *))
127 127 \end{document}
128 128 ((* endblock bodyEnd *))
129 129 ((* endblock body *))
130 130
131 131 ((* block header *))
132 132 %% This file was auto-generated by IPython.
133 133 %% Conversion from the original notebook file:
134 134 %%
135 135 \documentclass[11pt,english]{article}
136 136
137 137 %% This is the automatic preamble used by IPython. Note that it does *not*
138 138 %% include a documentclass declaration, that is added at runtime to the overall
139 139 %% document.
140 140
141 141 \usepackage{amsmath}
142 142 \usepackage{amssymb}
143 143 \usepackage{graphicx}
144 144 \usepackage{ucs}
145 145 \usepackage[utf8x]{inputenc}
146 146
147 % Scale down larger images
148 \usepackage[export]{adjustbox}
149
147 150 %fancy verbatim
148 151 \usepackage{fancyvrb}
149 152 % needed for markdown enumerations to work
150 153 \usepackage{enumerate}
151 154
152 155 % Slightly bigger margins than the latex defaults
153 156 \usepackage{geometry}
154 157 \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
155 158
156 159 % Define a few colors for use in code, links and cell shading
157 160 \usepackage{color}
158 161 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
159 162 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
160 163 \definecolor{darkgreen}{rgb}{.12,.54,.11}
161 164 \definecolor{myteal}{rgb}{.26, .44, .56}
162 165 \definecolor{gray}{gray}{0.45}
163 166 \definecolor{lightgray}{gray}{.95}
164 167 \definecolor{mediumgray}{gray}{.8}
165 168 \definecolor{inputbackground}{rgb}{.95, .95, .85}
166 169 \definecolor{outputbackground}{rgb}{.95, .95, .95}
167 170 \definecolor{traceback}{rgb}{1, .95, .95}
168 171
169 172 % new ansi colors
170 173 \definecolor{brown}{rgb}{0.54,0.27,0.07}
171 174 \definecolor{purple}{rgb}{0.5,0.0,0.5}
172 175 \definecolor{darkgray}{gray}{0.25}
173 176 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
174 177 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
175 178 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
176 179 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
177 180 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
178 181
179 182 % Framed environments for code cells (inputs, outputs, errors, ...). The
180 183 % various uses of \unskip (or not) at the end were fine-tuned by hand, so don't
181 184 % randomly change them unless you're sure of the effect it will have.
182 185 \usepackage{framed}
183 186
184 187 % remove extraneous vertical space in boxes
185 188 \setlength\fboxsep{0pt}
186 189
187 190 % codecell is the whole input+output set of blocks that a Code cell can
188 191 % generate.
189 192
190 193 % TODO: unfortunately, it seems that using a framed codecell environment breaks
191 194 % the ability of the frames inside of it to be broken across pages. This
192 195 % causes at least the problem of having lots of empty space at the bottom of
193 196 % pages as new frames are moved to the next page, and if a single frame is too
194 197 % long to fit on a page, will completely stop latex from compiling the
195 198 % document. So unless we figure out a solution to this, we'll have to instead
196 199 % leave the codecell env. as empty. I'm keeping the original codecell
197 200 % definition here (a thin vertical bar) for reference, in case we find a
198 201 % solution to the page break issue.
199 202
200 203 %% \newenvironment{codecell}{%
201 204 %% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
202 205 %% \MakeFramed{\vspace{-0.5em}}}
203 206 %% {\unskip\endMakeFramed}
204 207
205 208 % For now, make this a no-op...
206 209 \newenvironment{codecell}{}
207 210
208 211 \newenvironment{codeinput}{%
209 212 \def\FrameCommand{\colorbox{inputbackground}}%
210 213 \MakeFramed{\advance\hsize-\width \FrameRestore}}
211 214 {\unskip\endMakeFramed}
212 215
213 216 \newenvironment{codeoutput}{%
214 217 \def\FrameCommand{\colorbox{outputbackground}}%
215 218 \vspace{-1.4em}
216 219 \MakeFramed{\advance\hsize-\width \FrameRestore}}
217 220 {\unskip\medskip\endMakeFramed}
218 221
219 222 \newenvironment{traceback}{%
220 223 \def\FrameCommand{\colorbox{traceback}}%
221 224 \MakeFramed{\advance\hsize-\width \FrameRestore}}
222 225 {\endMakeFramed}
223 226
224 227 % Use and configure listings package for nicely formatted code
225 228 \usepackage{listingsutf8}
226 229 \lstset{
227 230 language=python,
228 231 inputencoding=utf8x,
229 232 extendedchars=\true,
230 233 aboveskip=\smallskipamount,
231 234 belowskip=\smallskipamount,
232 235 xleftmargin=2mm,
233 236 breaklines=true,
234 237 basicstyle=\small \ttfamily,
235 238 showstringspaces=false,
236 239 keywordstyle=\color{blue}\bfseries,
237 240 commentstyle=\color{myteal},
238 241 stringstyle=\color{darkgreen},
239 242 identifierstyle=\color{darkorange},
240 243 columns=fullflexible, % tighter character kerning, like verb
241 244 }
242 245
243 246 % The hyperref package gives us a pdf with properly built
244 247 % internal navigation ('pdf bookmarks' for the table of contents,
245 248 % internal cross-reference links, web links for URLs, etc.)
246 249 \usepackage{hyperref}
247 250 \hypersetup{
248 251 breaklinks=true, % so long urls are correctly broken across lines
249 252 colorlinks=true,
250 253 urlcolor=blue,
251 254 linkcolor=darkorange,
252 255 citecolor=darkgreen,
253 256 }
254 257
255 258 % hardcode size of all verbatim environments to be a bit smaller
256 259 \makeatletter
257 260 \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
258 261 \makeatother
259 262
260 263 % Prevent overflowing lines due to urls and other hard-to-break entities.
261 264 \sloppy
262 265
263 266 ((* endblock *))
General Comments 0
You need to be logged in to leave comments. Login now