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 | Overview |
|
5 | Overview | |
6 | ======== |
|
6 | ======== | |
7 |
|
7 | |||
8 | nbconvert provides command line utilities to convert to and from IPython |
|
8 | nbconvert provides command line utilities to convert to and from IPython | |
9 |
notebooks and standard formats |
|
9 | notebooks and standard formats. However, the latex formatting leaves | |
10 |
|
10 | something to be desired. This repository contains a port of the beautiful | ||
11 | - ReST |
|
11 | and popular Sphinx latex styles for nbconvert. | |
12 | - Markdown |
|
|||
13 | - HTML |
|
|||
14 |
|
||||
15 | - Python script |
|
|||
16 |
|
||||
17 | As these tools mature, these utilities will be merged into IPython. |
|
|||
18 |
|
12 | |||
19 | Requirements |
|
13 | Requirements | |
20 | ============ |
|
14 | ============ | |
@@ -25,9 +19,4 b' Sphinx-Latex:' | |||||
25 |
|
19 | |||
26 | see http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html |
|
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 | ((* block markdowncell scoped *))((( cell.source | markdown2latex ))) |
|
72 | ((* block markdowncell scoped *))((( cell.source | markdown2latex ))) | |
72 | ((* endblock markdowncell *)) |
|
73 | ((* endblock markdowncell *)) | |
|
74 | =)) | |||
73 |
|
75 | |||
74 | ((* block headingcell scoped *)) |
|
76 | ((* block headingcell scoped *)) | |
75 | \section{((( cell.source)))} |
|
77 | \section{((( cell.source)))} | |
@@ -85,10 +87,18 b' unknown type (((cell.type)))' | |||||
85 |
|
87 | |||
86 |
|
88 | |||
87 |
|
89 | |||
88 |
((* block body *)) |
|
90 | ((* block body *)) | |
|
91 | ||||
|
92 | ((* block bodyBegin *)) | |||
|
93 | \begin{document} | |||
|
94 | ((* endblock bodyBegin *)) | |||
|
95 | ||||
89 | ((( super() ))) |
|
96 | ((( super() ))) | |
|
97 | ||||
|
98 | ((* block bodyEnd *)) | |||
90 | \end{document} |
|
99 | \end{document} | |
91 | ((* endblock*)) |
|
100 | ((* endblock bodyEnd *)) | |
|
101 | ((* endblock body *)) | |||
92 |
|
102 | |||
93 | ((* block header *)) |
|
103 | ((* block header *)) | |
94 | %% This file was auto-generated by IPython. |
|
104 | %% This file was auto-generated by IPython. |
@@ -10,51 +10,119 b'' | |||||
10 |
|
10 | |||
11 | ((*- extends 'latex_base.tplx' -*)) |
|
11 | ((*- extends 'latex_base.tplx' -*)) | |
12 |
|
12 | |||
13 | ((============================================================================ |
|
13 | % Header, overrides base | |
14 | Header, overrides base |
|
|||
15 | ==========================================================================)) |
|
|||
16 | ((* block header *)) |
|
14 | ((* block header *)) | |
17 |
|
15 | |||
18 | %\newcommand{\sphinxlogo}{} |
|
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)))} | |||
19 |
|
21 | |||
20 | %% Generated by Sphinx (not really.) |
|
22 | % Imports | |
21 | \def\sphinxdocclass{((* block documentclass *))sphinxmanual((* endblock documentclass *))} |
|
23 | \usepackage[utf8]{inputenc} | |
22 | \documentclass[letterpaper,10pt,english]{report} |
|
24 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} | |
23 | \usepackage[utf8]{inputenc} %(inputenc)s |
|
25 | \usepackage[T1]{fontenc} | |
24 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} %(utf8extra)s |
|
26 | \usepackage{babel} | |
25 | \usepackage[T1]{fontenc} %(fontenc)s |
|
27 | \usepackage{times} | |
26 | \usepackage{babel} %(babel)s |
|
|||
27 | \usepackage{times} %(fontpkg)s |
|
|||
28 | \usepackage{import} |
|
28 | \usepackage{import} | |
29 | \usepackage[Bjarne]{templates/tex/fncychap} |
|
29 | \usepackage[Bjarne]{templates/tex/fncychap} | |
30 | %\usepackage[Bjarne]{} %(fncychap)s |
|
30 | \usepackage{longtable} | |
31 | \usepackage{longtable} %(longtable)s |
|
|||
32 | \usepackage{templates/tex/sphinx} |
|
31 | \usepackage{templates/tex/sphinx} | |
33 | \usepackage{multirow} |
|
32 | \usepackage{multirow} | |
34 |
|
33 | |||
35 | %"" (preamble)s |
|
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 | |||
36 |
|
42 | |||
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 |
|
43 | |||
45 |
((* block sphinx |
|
44 | ((* block sphinxheader *))((* endblock sphinxheader *)) | |
|
45 | ||||
46 | ((* endblock header *)) |
|
46 | ((* endblock header *)) | |
47 |
|
47 | |||
48 | ((* block body *)) |
|
48 | % Body | |
|
49 | ((* block bodyBegin *)) | |||
|
50 | ||||
|
51 | % Start of the document | |||
49 | \begin{document} |
|
52 | \begin{document} | |
50 | %(shorthandoff)s |
|
|||
51 | \maketitle |
|
53 | \maketitle | |
52 | \tableofcontents %(tableofcontents)s |
|
54 | \tableofcontents | |
|
55 | ((* endblock bodyBegin *)) | |||
|
56 | ((* block bodyEnd *)) | |||
|
57 | ||||
53 |
|
58 | |||
54 |
\renewcommand{\indexname}{ |
|
59 | \renewcommand{\indexname}{Index} | |
55 | \printindex %(printindex)s |
|
60 | \printindex | |
56 | \end{document} |
|
61 | \end{document} | |
57 | ((* endblock body *)) |
|
62 | ((* endblock bodyEnd *)) | |
58 |
|
63 | |||
|
64 | % Footer | |||
59 | ((* block footer *)) |
|
65 | ((* block footer *)) | |
60 | ((* endblock footer *)) |
|
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 | ((*- extends 'latex_sphinx_base.tplx' -*)) |
|
11 | ((*- extends 'latex_sphinx_base.tplx' -*)) | |
12 |
|
12 | |||
13 | ((* block documentclass *))sphinxhowto((* endblock documentclass *)) |
|
13 | ((* set parentdocumentclass = 'article' *)) | |
14 | ((* block sphinxstyle *))((* include 'sphinxhowto.cls' *))((* endblock sphinxstyle *)) |
|
14 | ((* set documentclass = 'howto' *)) | |
15 |
|
15 | |||
16 |
|
16 |
@@ -10,5 +10,5 b'' | |||||
10 |
|
10 | |||
11 | ((*- extends 'latex_sphinx_base.tplx' -*)) |
|
11 | ((*- extends 'latex_sphinx_base.tplx' -*)) | |
12 |
|
12 | |||
13 | ((* block documentclass *))sphinxmanual((* endblock documentclass *)) |
|
13 | ((* set parentdocumentclass = 'report' *)) | |
14 | ((* block sphinxstyle *))((* include 'sphinxmanual.cls' *))((* endblock sphinxstyle *)) |
|
14 | ((* set documentclass = 'manual' *)) |
@@ -79,7 +79,7 b'' | |||||
79 |
|
79 | |||
80 | % Catch the end of the {abstract} environment, but here make sure the abstract |
|
80 | % Catch the end of the {abstract} environment, but here make sure the abstract | |
81 | % is followed by a blank page if the 'openright' option is used. |
|
81 | % is followed by a blank page if the 'openright' option is used. | |
82 |
|
82 | % | ||
83 | \let\py@OldEndAbstract=\endabstract |
|
83 | \let\py@OldEndAbstract=\endabstract | |
84 | \renewcommand{\endabstract}{ |
|
84 | \renewcommand{\endabstract}{ | |
85 | \if@openright |
|
85 | \if@openright | |
@@ -117,7 +117,7 b'' | |||||
117 |
|
117 | |||
118 | % This is needed to get the width of the section # area wide enough in the |
|
118 | % This is needed to get the width of the section # area wide enough in the | |
119 | % library reference. Doing it here keeps it the same for all the manuals. |
|
119 | % library reference. Doing it here keeps it the same for all the manuals. | |
120 |
|
120 | % | ||
121 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} |
|
121 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} | |
122 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} |
|
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