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