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