Show More
@@ -1,144 +1,158 b'' | |||||
1 | ((============================================================================ |
|
1 | ((============================================================================ | |
2 | NBConvert Sphinx-Latex Template |
|
2 | NBConvert Sphinx-Latex Template | |
3 |
|
3 | |||
4 | Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the |
|
4 | Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the | |
5 | template is derived directly from Sphinx source. |
|
5 | template is derived directly from Sphinx source. | |
6 |
|
6 | |||
7 | Inheritance: null>display_priority>latex_base |
|
7 | Inheritance: null>display_priority>latex_base | |
8 |
|
8 | |||
9 | ==========================================================================)) |
|
9 | ==========================================================================)) | |
10 |
|
10 | |||
11 | ((*- extends 'latex_base.tplx' -*)) |
|
11 | ((*- extends 'latex_base.tplx' -*)) | |
12 |
|
12 | |||
13 | % Header, overrides base |
|
|||
14 | ((* block header *)) |
|
13 | ((* block header *)) | |
|
14 | % Header, overrides base | |||
15 |
|
15 | |||
16 | % Make sure that the sphinx doc style knows who it inherits from. |
|
16 | % Make sure that the sphinx doc style knows who it inherits from. | |
17 | \def\sphinxdocclass{(((parentdocumentclass)))} |
|
17 | \def\sphinxdocclass{(((parentdocumentclass)))} | |
18 |
|
18 | |||
19 | % Declare the document class |
|
19 | % Declare the document class | |
20 | \documentclass[letterpaper,10pt,english]{sphinx(((documentclass)))} |
|
20 | \documentclass[letterpaper,10pt,english]{sphinx(((documentclass)))} | |
21 |
|
21 | |||
22 | % Imports |
|
22 | % Imports | |
23 | \usepackage[utf8]{inputenc} |
|
23 | \usepackage[utf8]{inputenc} | |
24 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} |
|
24 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} | |
25 | \usepackage[T1]{fontenc} |
|
25 | \usepackage[T1]{fontenc} | |
26 | \usepackage{babel} |
|
26 | \usepackage{babel} | |
27 | \usepackage{times} |
|
27 | \usepackage{times} | |
28 | \usepackage{import} |
|
28 | \usepackage{import} | |
29 | \usepackage[Bjarne]{fncychap} |
|
29 | \usepackage[Bjarne]{fncychap} | |
30 | \usepackage{longtable} |
|
30 | \usepackage{longtable} | |
31 | \usepackage{sphinx} |
|
31 | \usepackage{sphinx} | |
32 | \usepackage{multirow} |
|
32 | \usepackage{multirow} | |
33 |
|
33 | |||
34 | % Document level variables |
|
34 | % Document level variables | |
35 | \title{((( nb.metadata.name )))} |
|
35 | \title{((( nb.metadata.name )))} | |
36 | \date{\today} |
|
36 | \date{\today} | |
37 | \release{} |
|
37 | \release{} | |
38 | \author{Unknown Author} |
|
38 | \author{Unknown Author} | |
39 | \newcommand{\sphinxlogo}{} |
|
39 | \newcommand{\sphinxlogo}{} | |
40 | \renewcommand{\releasename}{Release} |
|
40 | \renewcommand{\releasename}{Release} | |
41 | \makeindex |
|
41 | \makeindex | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | ((* block sphinxheader *))((* endblock sphinxheader *)) |
|
44 | ((* block sphinxheader *))((* endblock sphinxheader *)) | |
45 |
|
45 | |||
46 | ((* endblock header *)) |
|
46 | ((* endblock header *)) | |
47 |
|
47 | |||
48 | % Body |
|
|||
49 | ((* block bodyBegin *)) |
|
48 | ((* block bodyBegin *)) | |
|
49 | % Body | |||
50 |
|
50 | |||
51 | % Start of the document |
|
51 | % Start of the document | |
52 | \begin{document} |
|
52 | \begin{document} | |
53 | \maketitle |
|
53 | \maketitle | |
54 | \tableofcontents |
|
54 | \tableofcontents | |
55 | ((* endblock bodyBegin *)) |
|
|||
56 | ((* block bodyEnd *)) |
|
|||
57 |
|
55 | |||
|
56 | ((* endblock bodyBegin *))((* block bodyEnd *)) | |||
58 |
|
57 | |||
59 | \renewcommand{\indexname}{Index} |
|
58 | \renewcommand{\indexname}{Index} | |
60 | \printindex |
|
59 | \printindex | |
|
60 | ||||
|
61 | % End of document | |||
61 | \end{document} |
|
62 | \end{document} | |
62 | ((* endblock bodyEnd *)) |
|
63 | ((* endblock bodyEnd *)) | |
63 |
|
64 | |||
64 | % Footer |
|
65 | % Footer | |
65 | ((* block footer *)) |
|
66 | ((* block footer *)) | |
66 | ((* endblock footer *)) |
|
67 | ((* endblock footer *)) | |
67 |
|
68 | |||
68 |
((* |
|
69 | ((* block headingcell -*)) | |
69 |
|
||||
70 | ((= Prevent trim =)) |
|
|||
71 | ((("\n"))) |
|
|||
72 |
|
70 | |||
73 | ((*- if cell.level == 1 -*)) |
|
71 | ((*- if cell.level == 1 -*)) | |
74 | \part |
|
72 | \part | |
75 | ((*- elif cell.level == 2 -*)) |
|
73 | ((*- elif cell.level == 2 -*)) | |
76 | \chapter |
|
74 | \chapter | |
77 | ((*- elif cell.level == 3 -*)) |
|
75 | ((*- elif cell.level == 3 -*)) | |
78 | \section |
|
76 | \section | |
79 | ((*- elif cell.level == 4 -*)) |
|
77 | ((*- elif cell.level == 4 -*)) | |
80 | \subsection |
|
78 | \subsection | |
81 | ((*- elif cell.level == 5 -*)) |
|
79 | ((*- elif cell.level == 5 -*)) | |
82 | \subsubsection |
|
80 | \subsubsection | |
83 | ((*- elif cell.level == 6 -*)) |
|
81 | ((*- elif cell.level == 6 -*)) | |
84 | \paragraph |
|
82 | \paragraph | |
85 | ((*- endif -*)){((( cell.source )))} |
|
83 | ((*- endif -*)){((( filterOutLatex(cell.source) )))} | |
86 |
((*- endblock headingcell |
|
84 | ((*- endblock headingcell *)) | |
87 |
|
85 | |||
88 | ((*- block rawcell -*)) |
|
86 | ((*- block rawcell -*)) | |
89 | ((("\n"))) |
|
87 | ((("\n"))) | |
90 |
|
88 | |||
91 | \setbox0\vbox{ |
|
89 | \setbox0\vbox{ | |
92 | \begin{minipage}{0.95\linewidth} |
|
90 | \begin{minipage}{0.95\linewidth} | |
93 | ((( cell.source ))) |
|
91 | ((( filterOutLatex(cell.source) ))) | |
94 | \end{minipage}} |
|
92 | \end{minipage}} | |
95 | \begin{center}\setlength{\fboxsep}{5pt} |
|
93 | \begin{center}\setlength{\fboxsep}{5pt} | |
96 | \shadowbox{\box0}\end{center} |
|
94 | \shadowbox{\box0}\end{center} | |
97 |
|
95 | |||
98 | ((*- endblock rawcell -*)) |
|
96 | ((*- endblock rawcell -*)) | |
99 |
|
97 | |||
|
98 | ((*- block unknowncell scoped-*)) | |||
|
99 | ((("\n"))) | |||
|
100 | ||||
|
101 | % Unsupported cell type, no formatting | |||
|
102 | ((( filterOutLatex(cell.source) ))) | |||
|
103 | ((*- endblock unknowncell -*)) | |||
|
104 | ||||
|
105 | ((* macro filterOutLatex(text) -*)) | |||
|
106 | ((*- set text = text|replace("\\","\\backslash") -*)) | |||
|
107 | ((*- set text = text|replace("{","\\{") -*)) | |||
|
108 | ((*- set text = text|replace("}","\\}") -*)) | |||
|
109 | ((*- set text = text|replace("|","\\vert") -*)) | |||
|
110 | ((( text ))) | |||
|
111 | ((*- endmacro *)) | |||
|
112 | ||||
|
113 | ((======================================================================== | |||
|
114 | EVERYTHING BELOW HERE STILL NEEDS TO BE FILLED IN! | |||
|
115 | ========================================================================)) | |||
|
116 | ||||
100 | ((*- block codecell scoped -*)) |
|
117 | ((*- block codecell scoped -*)) | |
101 | ((*- block input_group -*)) |
|
118 | ((*- block input_group -*)) | |
102 | ((*- block in_prompt -*))((*- endblock in_prompt -*)) |
|
119 | ((*- block in_prompt -*))((*- endblock in_prompt -*)) | |
103 | ((*- block input -*))((*- endblock input -*)) |
|
120 | ((*- block input -*))((*- endblock input -*)) | |
104 | ((*- endblock input_group -*)) |
|
121 | ((*- endblock input_group -*)) | |
105 | ((*- if cell.outputs -*)) |
|
122 | ((*- if cell.outputs -*)) | |
106 | ((*- block output_group -*)) |
|
123 | ((*- block output_group -*)) | |
107 | ((*- block output_prompt -*))((*- endblock output_prompt -*)) |
|
124 | ((*- block output_prompt -*))((*- endblock output_prompt -*)) | |
108 | ((*- block outputs -*)) |
|
125 | ((*- block outputs -*)) | |
109 | ((*- for output in cell.outputs -*)) |
|
126 | ((*- for output in cell.outputs -*)) | |
110 | ((*- if output.output_type in ['pyout'] -*)) |
|
127 | ((*- if output.output_type in ['pyout'] -*)) | |
111 | ((*- block pyout scoped -*))((*- endblock pyout -*)) |
|
128 | ((*- block pyout scoped -*))((*- endblock pyout -*)) | |
112 | ((*- elif output.output_type in ['stream'] -*)) |
|
129 | ((*- elif output.output_type in ['stream'] -*)) | |
113 | ((*- block stream scoped -*)) |
|
130 | ((*- block stream scoped -*)) | |
114 | ((*- if output.stream in ['stdout'] -*)) |
|
131 | ((*- if output.stream in ['stdout'] -*)) | |
115 | ((*- block stream_stdout scoped -*)) |
|
132 | ((*- block stream_stdout scoped -*)) | |
116 | ((*- endblock stream_stdout -*)) |
|
133 | ((*- endblock stream_stdout -*)) | |
117 | ((*- elif output.stream in ['stderr'] -*)) |
|
134 | ((*- elif output.stream in ['stderr'] -*)) | |
118 | ((*- block stream_stderr scoped -*)) |
|
135 | ((*- block stream_stderr scoped -*)) | |
119 | ((*- endblock stream_stderr -*)) |
|
136 | ((*- endblock stream_stderr -*)) | |
120 | ((*- endif -*)) |
|
137 | ((*- endif -*)) | |
121 | ((*- endblock stream -*)) |
|
138 | ((*- endblock stream -*)) | |
122 | ((*- elif output.output_type in ['display_data'] -*)) |
|
139 | ((*- elif output.output_type in ['display_data'] -*)) | |
123 | ((*- block display_data scoped -*)) |
|
140 | ((*- block display_data scoped -*)) | |
124 | ((*- block data_priority scoped -*)) |
|
141 | ((*- block data_priority scoped -*)) | |
125 | ((*- endblock data_priority -*)) |
|
142 | ((*- endblock data_priority -*)) | |
126 | ((*- endblock display_data -*)) |
|
143 | ((*- endblock display_data -*)) | |
127 | ((*- elif output.output_type in ['pyerr'] -*)) |
|
144 | ((*- elif output.output_type in ['pyerr'] -*)) | |
128 | ((*- block pyerr scoped -*)) |
|
145 | ((*- block pyerr scoped -*)) | |
129 | ((*- for line in output.traceback -*)) |
|
146 | ((*- for line in output.traceback -*)) | |
130 | ((*- block traceback_line scoped -*))((*- endblock traceback_line -*)) |
|
147 | ((*- block traceback_line scoped -*))((*- endblock traceback_line -*)) | |
131 | ((*- endfor -*)) |
|
148 | ((*- endfor -*)) | |
132 | ((*- endblock pyerr -*)) |
|
149 | ((*- endblock pyerr -*)) | |
133 | ((*- endif -*)) |
|
150 | ((*- endif -*)) | |
134 | ((*- endfor -*)) |
|
151 | ((*- endfor -*)) | |
135 | ((*- endblock outputs -*)) |
|
152 | ((*- endblock outputs -*)) | |
136 | ((*- endblock output_group -*)) |
|
153 | ((*- endblock output_group -*)) | |
137 | ((*- endif -*)) |
|
154 | ((*- endif -*)) | |
138 | ((*- endblock codecell -*)) |
|
155 | ((*- endblock codecell -*)) | |
139 |
|
156 | |||
140 | ((*- block markdowncell scoped-*)) |
|
157 | ((*- block markdowncell scoped-*)) | |
141 | ((*- endblock markdowncell -*)) |
|
158 | ((*- endblock markdowncell -*)) | |
142 |
|
||||
143 | ((*- block unknowncell scoped-*)) |
|
|||
144 | ((*- endblock unknowncell -*)) |
|
General Comments 0
You need to be logged in to leave comments.
Login now