-
Notifications
You must be signed in to change notification settings - Fork 0
/
normal.tplx
90 lines (76 loc) · 2.96 KB
/
normal.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
((*- extends 'article.tplx' -*))
((* block title *))
((*- if "title" in nb.metadata *))
\title{((( nb.metadata.get("title", "") | ascii_only | escape_latex )))}
((*- else *))
\title{((( resources.metadata.name | ascii_only | escape_latex )))}
((*- endif -*))
((* endblock title *))
((* block date *))
((*- if "date" in nb.metadata *))
\date{((( nb.metadata.get("date", "") | ascii_only | escape_latex )))}
((*- endif -*))
((* endblock date *))
((* block author *))
((*- if "author" in nb.metadata *))
\author{((( nb.metadata.get("author", "") | ascii_only | escape_latex )))}
((*- endif -*))
((* endblock author *))
((* block commands *))
\usepackage{placeins}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}
\rfoot{\thepage\ of\ \pageref{LastPage}}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}
\rfoot{\thepage\ of\ \pageref{LastPage}}
}
% Prevent overflowing lines due to hard-to-break entities
\sloppy
% Setup hyperref package
\hypersetup{
breaklinks=true, % so long urls are correctly broken across lines
colorlinks=true,
urlcolor=urlcolor,
linkcolor=linkcolor,
citecolor=citecolor,
}
% Large right margin for notes
((* block margins *))
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1.25in,rmargin=1.25in}
((* endblock margins *))
((* endblock commands *))
%===============================================================================
% Input
%===============================================================================
((* block input scoped *))
((( custom_add_prompt(cell.source | wrap_text(80) | highlight_code(strip_verbatim=True), cell, 'In ', 'incolor') )))
((* endblock input *))
%===============================================================================
% Output
%===============================================================================
% Display stream ouput with coloring
((* block stream *))
\begin{Verbatim}[commandchars=\\\{\},fontsize=\footnotesize]
((( output.text | wrap_text(80) | escape_latex | ansi2latex )))
\end{Verbatim}
((* endblock stream *))
%==============================================================================
% Define macro custom_add_prompt() (derived from add_prompt() macro in style_ipython.tplx)
%==============================================================================
((* macro custom_add_prompt(text, cell, prompt, prompt_color) -*))
((*- if cell.execution_count is defined -*))
((*- set execution_count = "" ~ (cell.execution_count | replace(None, " ")) -*))
((*- else -*))
((*- set execution_count = " " -*))
((*- endif -*))
((*- set indention = " " * (execution_count | length + 7) -*))
%\begin{Verbatim}[commandchars=\\\{\},fontsize=\scriptsize]
\begin{Verbatim}[commandchars=\\\{\},fontsize=\footnotesize]
((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{' ~ prompt_color ~ '}' ~ execution_count ~ '}]:} ', cont=indention) )))
\end{Verbatim}
((*- endmacro *))