##// END OF EJS Templates
Added title to latex base
Jonathan Frederic -
Show More
@@ -1,189 +1,195 b''
1 1 ((= Latex base template (must inherit)
2 2 This template builds upon the abstract template, adding common latex output
3 3 functions. Figures, data_text,
4 4 This template does not define a docclass, the inheriting class must define this.=))
5 5
6 6 ((*- extends 'abstract.tplx' -*))
7 7
8 8 %===============================================================================
9 9 % Abstract overrides
10 10 %===============================================================================
11 11
12 12 ((* block packages *))
13 13 \usepackage{graphicx} % Used to insert images
14 14 \usepackage{adjustbox} % Used to constrain images to a maximum size
15 15 \usepackage{color} % Allow colors to be defined
16 16 \usepackage{enumerate} % Needed for markdown enumerations to work
17 17 \usepackage{fancyvrb} % Needed to support color codes (tex) in verbatim blocks
18 18 \usepackage{geometry} % Used to adjust the document margins
19 19 \usepackage{amsmath} % Equations
20 20 \usepackage{amssymb} % Equations
21 21 \usepackage[utf8]{inputenc} % Allow utf-8 characters in the tex document
22 22 \usepackage{ucs} % Extended unicode (utf-8) support
23 23 \usepackage{alltt} % Verbatim replacement that allows latex
24 24
25 25 \usepackage{grffile} % extends the file name processing of package graphics
26 26 %to support a larger range
27 27
28 28 % The hyperref package gives us a pdf with properly built
29 29 % internal navigation ('pdf bookmarks' for the table of contents,
30 30 % internal cross-reference links, web links for URLs, etc.)
31 31 \usepackage{hyperref}
32 32
33 33 % Pygments definitions
34 34 ((( resources.latex.pygment_definitions )))
35 35 ((* endblock packages *))
36 36
37 37 ((* block definitions *))
38 38 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
39 39 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
40 40 \definecolor{darkgreen}{rgb}{.12,.54,.11}
41 41 \definecolor{myteal}{rgb}{.26, .44, .56}
42 42 \definecolor{gray}{gray}{0.45}
43 43 \definecolor{lightgray}{gray}{.95}
44 44 \definecolor{mediumgray}{gray}{.8}
45 45 \definecolor{inputbackground}{rgb}{.95, .95, .85}
46 46 \definecolor{outputbackground}{rgb}{.95, .95, .95}
47 47 \definecolor{traceback}{rgb}{1, .95, .95}
48 48
49 49 % new ansi colors
50 50 \definecolor{brown}{rgb}{0.54,0.27,0.07}
51 51 \definecolor{purple}{rgb}{0.5,0.0,0.5}
52 52 \definecolor{darkgray}{gray}{0.25}
53 53 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
54 54 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
55 55 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
56 56 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
57 57 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
58 58
59 59 % Define a nice break command that doesn't care if a line doesn't already
60 60 % exist.
61 61 \def\br{\hspace*{\fill} \\* }
62 62
63 63 % Define a custom verbatim that allows latex
64 64 \renewenvironment{Verbatim}[1][\unskip]
65 65 {\begin{alltt}\smaller\noindent}
66 66 {\end{alltt}}
67 % Document title
68 \title{((( resources.metadata.name | escape_latex )))}
67 69 ((* endblock definitions *))
68 70
69 71 ((* block commands *))
70 72 \sloppy % Prevent overflowing lines due to hard-to-break entities
71 73
72 74 % Setup hyperref package
73 75 \hypersetup{
74 76 breaklinks=true, % so long urls are correctly broken across lines
75 77 colorlinks=true,
76 78 urlcolor=blue,
77 79 linkcolor=darkorange,
78 80 citecolor=darkgreen,
79 81 }
80 82
81 83 % Slightly bigger margins than the latex defaults
82 84 \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
83 85
84 86 % Hardcode size of all verbatim environments to be a bit smaller
85 87 \makeatletter
86 88 \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
87 89 \makeatother
88 90 ((* endblock commands *))
89 91
92 ((* block predoc *))
93 ((* block maketitle *))\maketitle((* endblock maketitle *))
94 ((* endblock predoc *))
95
90 96 %===============================================================================
91 97 % Support blocks
92 98 %===============================================================================
93 99
94 100 % Displaying simple data text
95 101 ((* block data_text *))
96 102 \begin{Verbatim}
97 103 ((( output.text | escape_latex )))
98 104 \end{Verbatim}
99 105 ((* endblock data_text *))
100 106
101 107 % Display python error text as-is
102 108 ((* block pyerr *))
103 109 \begin{Verbatim}
104 110 ((( super() )))
105 111 \end{Verbatim}
106 112 ((* endblock pyerr *))
107 113 ((* block traceback_line *))
108 114 ((( line | indent | strip_ansi | escape_latex )))
109 115 ((* endblock traceback_line *))
110 116
111 117 % Display stream ouput with coloring
112 118 ((* block stream *))
113 119 \begin{Verbatim}[commandchars=\\\{\}]
114 120 ((( output.text | ansi2latex )))
115 121 \end{Verbatim}
116 122 ((* endblock stream *))
117 123
118 124 % Display latex
119 125 ((* block data_latex -*))
120 126 ((*- if output.latex.startswith('$'): -*))
121 127 ((= Replace $ symbols with more explicit, equation block. =))
122 128 \begin{equation*}
123 129 ((( output.latex | strip_dollars )))
124 130 \end{equation*}
125 131 ((*- else -*))
126 132 ((( output.latex )))
127 133 ((*- endif *))
128 134 ((* endblock data_latex *))
129 135
130 136 % Default mechanism for rendering figures
131 137 ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*))
132 138 ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*))
133 139 ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*))
134 140 ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*))
135 141
136 142 % Draw a figure using the graphicx package.
137 143 ((* macro draw_figure(filename) -*))
138 144 ((* set filename = filename | posix_path *))
139 145 ((*- block figure scoped -*))
140 146 \begin{center}
141 147 \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
142 148 \end{center}
143 149 { \hspace*{\fill} \\}
144 150 ((*- endblock figure -*))
145 151 ((*- endmacro *))
146 152
147 153 % Draw heading cell. Explicitly map different cell levels.
148 154 ((* block headingcell scoped -*))
149 155 ((*- if cell.level == 1 -*))
150 156 ((* block h1 -*))\section((* endblock h1 -*))
151 157 ((*- elif cell.level == 2 -*))
152 158 ((* block h2 -*))\subsection((* endblock h2 -*))
153 159 ((*- elif cell.level == 3 -*))
154 160 ((* block h3 -*))\subsubsection((* endblock h3 -*))
155 161 ((*- elif cell.level == 4 -*))
156 162 ((* block h4 -*))\paragraph((* endblock h4 -*))
157 163 ((*- elif cell.level == 5 -*))
158 164 ((* block h5 -*))\subparagraph((* endblock h5 -*))
159 165 ((*- elif cell.level == 6 -*))
160 166 ((* block h6 -*))\\*\textit((* endblock h6 -*))
161 167 ((*- endif -*))
162 168 {((( cell.source | escape_latex )))}
163 169 ((*- endblock headingcell *))
164 170
165 171 % Redirect pyout to display data priority.
166 172 ((* block pyout scoped *))
167 173 ((* block data_priority scoped *))
168 174 ((( super() )))
169 175 ((* endblock *))
170 176 ((* endblock pyout *))
171 177
172 178 % Render markdown
173 179 ((* block markdowncell scoped *))
174 180 ((( cell.source | markdown2latex )))
175 181 ((* endblock markdowncell *))
176 182
177 183 % Spit out the contents of raw cells unmodified
178 184 ((* block rawcell scoped *))
179 185 ((( cell.source )))
180 186 ((* endblock rawcell *))
181 187
182 188 % Don't display unknown types
183 189 ((* block unknowncell scoped *))
184 190 ((* endblock unknowncell *))
185 191
186 192 % Render code using pygments
187 193 ((* block input scoped *))
188 194 ((( cell.input | highlight2latex )))
189 195 ((* endblock input *)) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now