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