##// END OF EJS Templates
Tex stack exchange suggestions
Jonathan Frederic -
Show More
@@ -38,11 +38,3 b''
38 38 \makeindex
39 39
40 40 ((* endblock commands *))
41
42 ((* block notebook_input_extra_space -*))
43 \vspace{-0.9\baselineskip}%
44 ((*- endblock notebook_input_extra_space *))
45
46 ((* block notebook_output_extra_space -*))
47 \vspace{-0.6\baselineskip}%
48 ((*- endblock notebook_output_extra_space *))
@@ -19,9 +19,6 b''
19 19 % Pygments definitions
20 20 ((( resources.latex.pygment_definitions )))
21 21
22 % NB prompt font size
23 \def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont}
24
25 22 % NB prompt colors
26 23 \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867}
27 24 \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969}
@@ -35,6 +32,11 b''
35 32 \setlength{\cellleftmargin}{0.15\linewidth}
36 33 \newlength{\borderthickness}
37 34 \setlength{\borderthickness}{0.4pt}
35 \newlength{\smallerfontscale}
36 \setlength{\smallerfontscale}{9.5pt}
37
38 % NB prompt font size
39 \def\smaller{\fontsize{\smallerfontscale}{\smallerfontscale}\selectfont}
38 40
39 41 % Define a background layer, in which the nb prompt shape is drawn
40 42 \pgfdeclarelayer{background}
@@ -110,11 +112,11 b''
110 112 \def\FirstFrameCommand{\notebookcellframetop}%
111 113 \def\LastFrameCommand{\notebookcellframebottom}%
112 114 \def\MidFrameCommand{\notebookcellframemiddle}%
113 \vskip\baselineskip%
115 \par\vspace{1\baselineskip}%
114 116 \MakeFramed {\FrameRestore}%
115 117 \noindent\tikz\node[inner sep=0em] at ($(A.north west)-(0,0)$) {%
116 118 ((( draw_prompt("In ", "#1", "nbframe-in-prompt", "2pt") )))%
117 }; }%
119 }; \par}%
118 120 {\endMakeFramed}
119 121
120 122 ((* endblock definitions *))
@@ -127,16 +129,18 b''
127 129 ((* block input scoped *))
128 130 % Add contents below.
129 131
132 {\par%
130 133 \vspace{-1\baselineskip}%
131 \needspace{4\baselineskip}%
134 \needspace{4\baselineskip}}%
132 135 \begin{notebookcell}[((( cell.prompt_number )))]%
133 136 \begin{addmargin}[\cellleftmargin]{0em}% left, right
134 ((* block notebook_input_extra_space *))%((* endblock notebook_input_extra_space *))
135 \smaller%
136 \vspace{-1\baselineskip}%
137 \vspace{-1\borderthickness}%
137 {\smaller%
138 \par%
139 ((* block extra_input_spacing *))((* endblock extra_input_spacing *))%
140 \vspace{-1\smallerfontscale}%
138 141 ((( cell.input | highlight2latex )))%
139 \vspace{-1\baselineskip}%
142 \par%
143 \vspace{-1\smallerfontscale}}%
140 144 \end{addmargin}
141 145 \end{notebookcell}
142 146
@@ -146,24 +150,25 b''
146 150 % Output
147 151 %===============================================================================
148 152
149 ((* block output *))
150 \vspace{1\baselineskip}%
153 ((* block output -*))
154 \par\vspace{1\smallerfontscale}%
151 155 % Only render the prompt if the cell is pyout. Note, the outputs prompt
152 156 % block isn't used since we need to check each indiviual output and only
153 157 % add prompts to the pyout ones.
154 158 ((* if output.output_type in ['pyout'] *))
155 \vspace{-1\baselineskip}%
159 {\par%
160 \vspace{-1\smallerfontscale}%
156 161 \noindent%
157 162 ((( draw_prompt("Out", cell.prompt_number, "nbframe-out-prompt", "0em") )))%
163 ((* block extra_output_spacing *))((* endblock extra_output_spacing *))}%
158 164 ((* endif *))%
159 165 %
160 166 \begin{addmargin}[\cellleftmargin]{0em}% left, right
161 \smaller%
162 ((* block notebook_output_extra_space *))%((* endblock notebook_output_extra_space *))
163 \vspace{-1\baselineskip}%
164 ((( super() )))
165 \end{addmargin}
166 ((* endblock output *))
167 {\smaller%
168 \vspace{-1\smallerfontscale}%
169 ((( super() )))}%
170 \end{addmargin}%
171 ((*- endblock output *))
167 172
168 173 %==============================================================================
169 174 % Support Macros
@@ -172,14 +177,15 b''
172 177 % Name: draw_prompt
173 178 % Purpose: Renders an output/input prompt for notebook style pdfs
174 179 ((* macro draw_prompt(prompt, number, color, space) -*))
175 \begin{minipage}{\cellleftmargin}
176 \smaller%
180 \begin{minipage}{\cellleftmargin}%
181 \hfill%
182 {\smaller%
177 183 \tt%
178 184 \color{(((color)))}%
179 \hfill%
180 (((prompt)))[(((number)))]:%
185 (((prompt)))[(((number)))]:}%
181 186 \hspace{\inputpadding}%
182 187 \hspace{(((space)))}%
183 188 \hspace{3pt}%
184 \end{minipage}
189 \end{minipage}%
185 190 ((*- endmacro *))
191
General Comments 0
You need to be logged in to leave comments. Login now