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