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