##// END OF EJS Templates
Got both of the main template formats from sphinx rendering....
Jonathan Frederic -
Show More
@@ -1,20 +1,14 b''
1 1 ================================================================
2 nbconvert: conversion utilities for the IPython notebook format
2 nbconvert Sphinx-Latex Jinja2 templates
3 3 ================================================================
4 4
5 5 Overview
6 6 ========
7 7
8 8 nbconvert provides command line utilities to convert to and from IPython
9 notebooks and standard formats:
10
11 - ReST
12 - Markdown
13 - HTML
14 - PDF
15 - Python script
16
17 As these tools mature, these utilities will be merged into IPython.
9 notebooks and standard formats. However, the latex formatting leaves
10 something to be desired. This repository contains a port of the beautiful
11 and popular Sphinx latex styles for nbconvert.
18 12
19 13 Requirements
20 14 ============
@@ -25,9 +19,4 b' Sphinx-Latex:'
25 19
26 20 see http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html
27 21
28 Running Tests
29 =============
30
31 Using nbconvert
32 ===============
33 22
@@ -67,9 +67,11 b' it introduces a new line'
67 67
68 68
69 69
70
70 ((=
71 %Doesn't work on my machine yet. TODO: Fix this.
71 72 ((* block markdowncell scoped *))((( cell.source | markdown2latex )))
72 73 ((* endblock markdowncell *))
74 =))
73 75
74 76 ((* block headingcell scoped *))
75 77 \section{((( cell.source)))}
@@ -85,10 +87,18 b' unknown type (((cell.type)))'
85 87
86 88
87 89
88 ((* block body *))\begin{document}
89 ((( super() )))
90 \end{document}
91 ((* endblock*))
90 ((* block body *))
91
92 ((* block bodyBegin *))
93 \begin{document}
94 ((* endblock bodyBegin *))
95
96 ((( super() )))
97
98 ((* block bodyEnd *))
99 \end{document}
100 ((* endblock bodyEnd *))
101 ((* endblock body *))
92 102
93 103 ((* block header *))
94 104 %% This file was auto-generated by IPython.
@@ -10,51 +10,119 b''
10 10
11 11 ((*- extends 'latex_base.tplx' -*))
12 12
13 ((============================================================================
14 Header, overrides base
15 ==========================================================================))
13 % Header, overrides base
16 14 ((* block header *))
15
16 % Make sure that the sphinx doc style knows who it inherits from.
17 \def\sphinxdocclass{(((parentdocumentclass)))}
18
19 % Declare the document class
20 \documentclass[letterpaper,10pt,english]{templates/tex/sphinx(((documentclass)))}
21
22 % Imports
23 \usepackage[utf8]{inputenc}
24 \DeclareUnicodeCharacter{00A0}{\\nobreakspace}
25 \usepackage[T1]{fontenc}
26 \usepackage{babel}
27 \usepackage{times}
28 \usepackage{import}
29 \usepackage[Bjarne]{templates/tex/fncychap}
30 \usepackage{longtable}
31 \usepackage{templates/tex/sphinx}
32 \usepackage{multirow}
33
34 % Document level variables
35 \title{((( nb.metadata.name )))}
36 \date{\today}
37 \release{}
38 \author{Unknown Author}
39 \newcommand{\sphinxlogo}{}
40 \renewcommand{\releasename}{Release}
41 \makeindex
42
43
44 ((* block sphinxheader *))((* endblock sphinxheader *))
17 45
18 %\newcommand{\sphinxlogo}{}
19
20 %% Generated by Sphinx (not really.)
21 \def\sphinxdocclass{((* block documentclass *))sphinxmanual((* endblock documentclass *))}
22 \documentclass[letterpaper,10pt,english]{report}
23 \usepackage[utf8]{inputenc} %(inputenc)s
24 \DeclareUnicodeCharacter{00A0}{\\nobreakspace} %(utf8extra)s
25 \usepackage[T1]{fontenc} %(fontenc)s
26 \usepackage{babel} %(babel)s
27 \usepackage{times} %(fontpkg)s
28 \usepackage{import}
29 \usepackage[Bjarne]{templates/tex/fncychap}
30 %\usepackage[Bjarne]{} %(fncychap)s
31 \usepackage{longtable} %(longtable)s
32 \usepackage{templates/tex/sphinx}
33 \usepackage{multirow}
34
35 %"" (preamble)s
36
37 \title{((( nb.metadata.name )))} %(title)s}
38 \date{} %(date)s}
39 \release{} %(release)s}
40 \author{} %(author)s}
41 \newcommand{\sphinxlogo}{} %(logo)s}
42 \renewcommand{\releasename}{Release} %(releasename)s}
43 \makeindex %(makeindex)s
44
45 ((* block sphinxstyle *))((* endblock sphinxstyle *))
46 46 ((* endblock header *))
47 47
48 ((* block body *))
49 \begin{document}
50 %(shorthandoff)s
51 \maketitle
52 \tableofcontents %(tableofcontents)s
48 % Body
49 ((* block bodyBegin *))
53 50
54 \renewcommand{\indexname}{%(indexname)s}
55 \printindex %(printindex)s
56 \end{document}
57 ((* endblock body *))
51 % Start of the document
52 \begin{document}
53 \maketitle
54 \tableofcontents
55 ((* endblock bodyBegin *))
56 ((* block bodyEnd *))
58 57
58
59 \renewcommand{\indexname}{Index}
60 \printindex
61 \end{document}
62 ((* endblock bodyEnd *))
63
64 % Footer
59 65 ((* block footer *))
60 66 ((* endblock footer *))
67
68 ((*- block any_cell scoped -*))
69 ((( cell.source)))
70 ((*- if cell.type in ['code'] -*))
71
72 ((*- block codecell scoped -*))
73 ((*- block input_group -*))
74 ((*- block in_prompt -*))((*- endblock in_prompt -*))
75 ((*- block input -*))((*- endblock input -*))
76 ((*- endblock input_group -*))
77 ((*- if cell.outputs -*))
78 ((*- block output_group -*))
79 ((*- block output_prompt -*))((*- endblock output_prompt -*))
80 ((*- block outputs -*))
81 ((*- for output in cell.outputs -*))
82 ((*- if output.output_type in ['pyout'] -*))
83 ((*- block pyout scoped -*))((*- endblock pyout -*))
84 ((*- elif output.output_type in ['stream'] -*))
85 ((*- block stream scoped -*))
86 ((*- if output.stream in ['stdout'] -*))
87 ((*- block stream_stdout scoped -*))
88 ((*- endblock stream_stdout -*))
89 ((*- elif output.stream in ['stderr'] -*))
90 ((*- block stream_stderr scoped -*))
91 ((*- endblock stream_stderr -*))
92 ((*- endif -*))
93 ((*- endblock stream -*))
94 ((*- elif output.output_type in ['display_data'] -*))
95 ((*- block display_data scoped -*))
96 ((*- block data_priority scoped -*))
97 ((*- endblock data_priority -*))
98 ((*- endblock display_data -*))
99 ((*- elif output.output_type in ['pyerr'] -*))
100 ((*- block pyerr scoped -*))
101 ((*- for line in output.traceback -*))
102 ((*- block traceback_line scoped -*))((*- endblock traceback_line -*))
103 ((*- endfor -*))
104 ((*- endblock pyerr -*))
105 ((*- endif -*))
106 ((*- endfor -*))
107 ((*- endblock outputs -*))
108 ((*- endblock output_group -*))
109 ((*- endif -*))
110 ((*- endblock codecell -*))
111 ((*- elif cell.type in ['markdown'] -*))
112
113 ((*- block markdowncell scoped-*))
114 ((*- endblock markdowncell -*))
115 ((*- elif cell.type in ['heading'] -*))
116
117 ((*- block headingcell scoped-*))
118 ((*- endblock headingcell -*))
119 ((*- elif cell.type in ['raw'] -*))
120
121 ((*- block rawcell scoped-*))
122 ((*- endblock rawcell -*))
123 ((*- else -*))
124
125 ((*- block unknowncell scoped-*))
126 ((*- endblock unknowncell -*))
127 ((*- endif -*))
128 ((*- endblock any_cell -*))
@@ -10,7 +10,7 b''
10 10
11 11 ((*- extends 'latex_sphinx_base.tplx' -*))
12 12
13 ((* block documentclass *))sphinxhowto((* endblock documentclass *))
14 ((* block sphinxstyle *))((* include 'sphinxhowto.cls' *))((* endblock sphinxstyle *))
13 ((* set parentdocumentclass = 'article' *))
14 ((* set documentclass = 'howto' *))
15 15
16 16
@@ -10,5 +10,5 b''
10 10
11 11 ((*- extends 'latex_sphinx_base.tplx' -*))
12 12
13 ((* block documentclass *))sphinxmanual((* endblock documentclass *))
14 ((* block sphinxstyle *))((* include 'sphinxmanual.cls' *))((* endblock sphinxstyle *))
13 ((* set parentdocumentclass = 'report' *))
14 ((* set documentclass = 'manual' *))
@@ -79,7 +79,7 b''
79 79
80 80 % Catch the end of the {abstract} environment, but here make sure the abstract
81 81 % is followed by a blank page if the 'openright' option is used.
82
82 %
83 83 \let\py@OldEndAbstract=\endabstract
84 84 \renewcommand{\endabstract}{
85 85 \if@openright
@@ -117,7 +117,7 b''
117 117
118 118 % This is needed to get the width of the section # area wide enough in the
119 119 % library reference. Doing it here keeps it the same for all the manuals.
120
120 %
121 121 \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
122 122 \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
123 123
General Comments 0
You need to be logged in to leave comments. Login now