/
style_hr.tplx
68 lines (54 loc) · 1.93 KB
/
style_hr.tplx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
((= Simple input/output style =))
((*- extends 'latex_base.tplx' -*))
% Custom packages
((* block packages *))
((( super() )))
\usepackage{needspace} % Make prompts follow contents
((* endblock packages *))
% Custom definitions
((* block definitions *))
((( super() )))
% Pygments definitions
((( resources.latex.pygments_definitions )))
\newlength{\promptspace}
\setlength{\promptspace}{4\baselineskip} % Space needed to start a new
% input/output
((* endblock definitions *))
%===============================================================================
% Input
%===============================================================================
((*- block in_prompt scoped -*))
\par\vspace{-1\baselineskip}
((( draw_prompt('Input') )))
((*- endblock in_prompt -*))
((*- block input_group scoped -*))
(((- super() )))
\par\vspace{-2\baselineskip}
((* endblock input_group -*))
((* block input scoped *))
((( cell.input | highlight2latex )))
((* endblock input *))
%===============================================================================
% Output
%===============================================================================
((*- block output_prompt scoped -*))
((( draw_prompt('Output') )))
((*- endblock output_prompt -*))
((*- block output_group scoped -*))
(((- super() )))
\par\vspace{-1\baselineskip}
((* endblock output_group -*))
%==============================================================================
% Support Macros
%==============================================================================
% Name: draw_prompt
% Purpose: Renders an output/input prompt for notebook style pdfs
((* macro draw_prompt(prompt) *))
% Add a horizantal break, along with break title.
\needspace{\promptspace}
\br\br
{\scriptsize ((( prompt )))}
\br
\rule[10pt]{\linewidth}{0.5pt}
\vspace{-2.5em}
((* endmacro *))