Show More
@@ -1,126 +1,121 b'' | |||
|
1 | 1 | ((= Notebook input/output style =)) |
|
2 | 2 | |
|
3 | 3 | ((* extends 'latex_base.tplx' *)) |
|
4 | 4 | |
|
5 | 5 | % Custom packages |
|
6 | 6 | ((* block packages *)) |
|
7 | 7 | ((( super() ))) |
|
8 | 8 | |
|
9 | 9 | % Needed to box output/input |
|
10 | 10 | \usepackage{tikz} |
|
11 | 11 | \usetikzlibrary{calc,arrows,shadows} |
|
12 | 12 | \usepackage[framemethod=tikz]{((( resources.latex.mdframed_path | posix_path )))/mdframed} |
|
13 | 13 | |
|
14 | 14 | \usepackage{scrextend} % Used to indent output |
|
15 | 15 | \usepackage{needspace} % Make prompts follow contents |
|
16 | 16 | ((* endblock packages *)) |
|
17 | 17 | |
|
18 | 18 | % Custom definitions |
|
19 | 19 | ((* block definitions *)) |
|
20 | 20 | ((( super() ))) |
|
21 | 21 | |
|
22 | 22 | \listfiles |
|
23 | 23 | |
|
24 | 24 | \def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont} |
|
25 | 25 | |
|
26 | 26 | \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867} |
|
27 | 27 | \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969} |
|
28 | 28 | \definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502} |
|
29 | 29 | \definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0} |
|
30 | 30 | |
|
31 | 31 | \newenvironment{ColorVerbatim} |
|
32 | 32 | {\vspace{-2\baselineskip} |
|
33 | 33 | \leavevmode\begin{mdframed}[% |
|
34 | 34 | roundcorner=1.0pt, % |
|
35 | 35 | backgroundcolor=nbframe-bg, % |
|
36 | userdefinedwidth=1\linewidth, % | |
|
37 | 36 | leftmargin=0.1\linewidth, % |
|
38 | 37 | innerleftmargin=0pt, % |
|
39 | 38 | innerrightmargin=0pt, % |
|
40 | 39 | linecolor=nbframe-border, % |
|
41 | 40 | linewidth=1pt, % |
|
42 | 41 | usetwoside=false, % |
|
43 | 42 | everyline=false, % |
|
44 | 43 | innerlinewidth=3pt, % |
|
45 | 44 | innerlinecolor=nbframe-bg, % |
|
46 | 45 | middlelinewidth=1pt, % |
|
47 | 46 | middlelinecolor=nbframe-bg, % |
|
48 | 47 | outerlinewidth=0.5pt, % |
|
49 | 48 | outerlinecolor=nbframe-border, % |
|
50 | 49 | needspace=3em, % |
|
51 | 50 | nobreak=false |
|
52 | 51 | ]} |
|
53 | 52 | {\end{mdframed}\vspace{-1\baselineskip}} |
|
54 | 53 | |
|
55 | % Space needed to start a new input/output | |
|
56 | \newlength{\promptspace} | |
|
57 | \setlength{\promptspace}{4\baselineskip} | |
|
58 | 54 | ((* endblock definitions *)) |
|
59 | 55 | |
|
60 | 56 | %=============================================================================== |
|
61 | 57 | % Input |
|
62 | 58 | %=============================================================================== |
|
63 | 59 | |
|
64 | 60 | |
|
65 | 61 | ((* block in_prompt scoped *)) |
|
66 | 62 | \br |
|
67 | 63 | ((( draw_prompt("In", cell.prompt_number, "nbframe-in-prompt") ))) |
|
68 | 64 | ((* endblock in_prompt *)) |
|
69 | 65 | |
|
70 | 66 | ((* block input scoped *)) |
|
71 | 67 | % Add contents below. |
|
72 | 68 | |
|
73 | 69 | \begin{ColorVerbatim} |
|
74 | \smaller{\leavevmode\hspace*{-0.1\linewidth}((( super() )))} | |
|
70 | In [0]: \vspace{-1\baselineskip}\smaller{((( super() )))} | |
|
75 | 71 | \end{ColorVerbatim} |
|
76 | 72 | ((* endblock input *)) |
|
77 | 73 | |
|
78 | 74 | ((* block input_group scoped *)) |
|
79 | 75 | ((( super() ))) |
|
80 | 76 | ((* endblock input_group *)) |
|
81 | 77 | |
|
82 | 78 | |
|
83 | 79 | %=============================================================================== |
|
84 | 80 | % Output |
|
85 | 81 | %=============================================================================== |
|
86 | 82 | |
|
87 | 83 | ((* block output_group *)) |
|
88 | 84 | {\br}((( super() ))) |
|
89 | 85 | ((* endblock output_group *)) |
|
90 | 86 | |
|
91 | 87 | ((* block output *)) |
|
92 | 88 | |
|
93 | 89 | % Only render the prompt if the cell is pyout. Note, the outputs prompt |
|
94 | 90 | % block isn't used since we need to check each indiviual output and only |
|
95 | 91 | % add prompts to the pyout ones. |
|
96 | 92 | ((* if output.output_type in ['pyout'] *)) |
|
97 | 93 | ((( draw_prompt("Out", cell.prompt_number, "nbframe-out-prompt") ))) |
|
98 | 94 | ((* endif *)) |
|
99 | 95 | |
|
100 | 96 | \begin{addmargin}[0.1\linewidth]{0em} % left, right |
|
101 | 97 | \smaller{((( super() )))} |
|
102 | 98 | \end{addmargin} |
|
103 | 99 | ((* endblock output *)) |
|
104 | 100 | |
|
105 | 101 | %============================================================================== |
|
106 | 102 | % Support Macros |
|
107 | 103 | %============================================================================== |
|
108 | 104 | |
|
109 | 105 | % Name: draw_prompt |
|
110 | 106 | % Purpose: Renders an output/input prompt for notebook style pdfs. Prompt is |
|
111 | 107 | % rendered at the current location, the cursor position is left |
|
112 | 108 | % unmodified. |
|
113 | 109 | ((* macro draw_prompt(prompt, number, color) *)) |
|
114 | \needspace{\promptspace} | |
|
115 | ||
|
110 | ||
|
116 | 111 | { |
|
117 | 112 | \smaller |
|
118 | 113 | \tt |
|
119 | 114 | \color{((( color )))} |
|
120 | \noindent | |
|
115 | \noindent\relax | |
|
121 | 116 | ((( prompt ))) |
|
122 | 117 | {[}((( number ))){]}: |
|
123 | 118 | } |
|
124 | 119 | |
|
125 | 120 | \vspace{-1\baselineskip} |
|
126 | 121 | ((* endmacro *)) |
General Comments 0
You need to be logged in to leave comments.
Login now