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