Show More
@@ -1,126 +1,121 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]{((( resources.latex.mdframed_path | posix_path )))/mdframed} |
|
12 | \usepackage[framemethod=tikz]{((( resources.latex.mdframed_path | posix_path )))/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, % |
|
|||
37 | leftmargin=0.1\linewidth, % |
|
36 | leftmargin=0.1\linewidth, % | |
38 | innerleftmargin=0pt, % |
|
37 | innerleftmargin=0pt, % | |
39 | innerrightmargin=0pt, % |
|
38 | innerrightmargin=0pt, % | |
40 | linecolor=nbframe-border, % |
|
39 | linecolor=nbframe-border, % | |
41 | linewidth=1pt, % |
|
40 | linewidth=1pt, % | |
42 | usetwoside=false, % |
|
41 | usetwoside=false, % | |
43 | everyline=false, % |
|
42 | everyline=false, % | |
44 | innerlinewidth=3pt, % |
|
43 | innerlinewidth=3pt, % | |
45 | innerlinecolor=nbframe-bg, % |
|
44 | innerlinecolor=nbframe-bg, % | |
46 | middlelinewidth=1pt, % |
|
45 | middlelinewidth=1pt, % | |
47 | middlelinecolor=nbframe-bg, % |
|
46 | middlelinecolor=nbframe-bg, % | |
48 | outerlinewidth=0.5pt, % |
|
47 | outerlinewidth=0.5pt, % | |
49 | outerlinecolor=nbframe-border, % |
|
48 | outerlinecolor=nbframe-border, % | |
50 | needspace=3em, % |
|
49 | needspace=3em, % | |
51 | nobreak=false |
|
50 | nobreak=false | |
52 | ]} |
|
51 | ]} | |
53 | {\end{mdframed}\vspace{-1\baselineskip}} |
|
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 | ((* endblock definitions *)) |
|
54 | ((* endblock definitions *)) | |
59 |
|
55 | |||
60 | %=============================================================================== |
|
56 | %=============================================================================== | |
61 | % Input |
|
57 | % Input | |
62 | %=============================================================================== |
|
58 | %=============================================================================== | |
63 |
|
59 | |||
64 |
|
60 | |||
65 | ((* block in_prompt scoped *)) |
|
61 | ((* block in_prompt scoped *)) | |
66 | \br |
|
62 | \br | |
67 | ((( draw_prompt("In", cell.prompt_number, "nbframe-in-prompt") ))) |
|
63 | ((( draw_prompt("In", cell.prompt_number, "nbframe-in-prompt") ))) | |
68 | ((* endblock in_prompt *)) |
|
64 | ((* endblock in_prompt *)) | |
69 |
|
65 | |||
70 | ((* block input scoped *)) |
|
66 | ((* block input scoped *)) | |
71 | % Add contents below. |
|
67 | % Add contents below. | |
72 |
|
68 | |||
73 | \begin{ColorVerbatim} |
|
69 | \begin{ColorVerbatim} | |
74 | \smaller{\leavevmode\hspace*{-0.1\linewidth}((( super() )))} |
|
70 | In [0]: \vspace{-1\baselineskip}\smaller{((( super() )))} | |
75 | \end{ColorVerbatim} |
|
71 | \end{ColorVerbatim} | |
76 | ((* endblock input *)) |
|
72 | ((* endblock input *)) | |
77 |
|
73 | |||
78 | ((* block input_group scoped *)) |
|
74 | ((* block input_group scoped *)) | |
79 | ((( super() ))) |
|
75 | ((( super() ))) | |
80 | ((* endblock input_group *)) |
|
76 | ((* endblock input_group *)) | |
81 |
|
77 | |||
82 |
|
78 | |||
83 | %=============================================================================== |
|
79 | %=============================================================================== | |
84 | % Output |
|
80 | % Output | |
85 | %=============================================================================== |
|
81 | %=============================================================================== | |
86 |
|
82 | |||
87 | ((* block output_group *)) |
|
83 | ((* block output_group *)) | |
88 | {\br}((( super() ))) |
|
84 | {\br}((( super() ))) | |
89 | ((* endblock output_group *)) |
|
85 | ((* endblock output_group *)) | |
90 |
|
86 | |||
91 | ((* block output *)) |
|
87 | ((* block output *)) | |
92 |
|
88 | |||
93 | % Only render the prompt if the cell is pyout. Note, the outputs prompt |
|
89 | % 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 |
|
90 | % block isn't used since we need to check each indiviual output and only | |
95 | % add prompts to the pyout ones. |
|
91 | % add prompts to the pyout ones. | |
96 | ((* if output.output_type in ['pyout'] *)) |
|
92 | ((* if output.output_type in ['pyout'] *)) | |
97 | ((( draw_prompt("Out", cell.prompt_number, "nbframe-out-prompt") ))) |
|
93 | ((( draw_prompt("Out", cell.prompt_number, "nbframe-out-prompt") ))) | |
98 | ((* endif *)) |
|
94 | ((* endif *)) | |
99 |
|
95 | |||
100 | \begin{addmargin}[0.1\linewidth]{0em} % left, right |
|
96 | \begin{addmargin}[0.1\linewidth]{0em} % left, right | |
101 | \smaller{((( super() )))} |
|
97 | \smaller{((( super() )))} | |
102 | \end{addmargin} |
|
98 | \end{addmargin} | |
103 | ((* endblock output *)) |
|
99 | ((* endblock output *)) | |
104 |
|
100 | |||
105 | %============================================================================== |
|
101 | %============================================================================== | |
106 | % Support Macros |
|
102 | % Support Macros | |
107 | %============================================================================== |
|
103 | %============================================================================== | |
108 |
|
104 | |||
109 | % Name: draw_prompt |
|
105 | % Name: draw_prompt | |
110 | % Purpose: Renders an output/input prompt for notebook style pdfs. Prompt is |
|
106 | % Purpose: Renders an output/input prompt for notebook style pdfs. Prompt is | |
111 | % rendered at the current location, the cursor position is left |
|
107 | % rendered at the current location, the cursor position is left | |
112 | % unmodified. |
|
108 | % unmodified. | |
113 | ((* macro draw_prompt(prompt, number, color) *)) |
|
109 | ((* macro draw_prompt(prompt, number, color) *)) | |
114 | \needspace{\promptspace} |
|
110 | ||
115 |
|
||||
116 | { |
|
111 | { | |
117 | \smaller |
|
112 | \smaller | |
118 | \tt |
|
113 | \tt | |
119 | \color{((( color )))} |
|
114 | \color{((( color )))} | |
120 | \noindent |
|
115 | \noindent\relax | |
121 | ((( prompt ))) |
|
116 | ((( prompt ))) | |
122 | {[}((( number ))){]}: |
|
117 | {[}((( number ))){]}: | |
123 | } |
|
118 | } | |
124 |
|
119 | |||
125 | \vspace{-1\baselineskip} |
|
120 | \vspace{-1\baselineskip} | |
126 | ((* endmacro *)) |
|
121 | ((* endmacro *)) |
General Comments 0
You need to be logged in to leave comments.
Login now