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