Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 16 commits
  • 2 files changed
  • 0 commit comments
  • 3 contributors
Commits on May 28, 2012
@Carreau Carreau somme support for utf-8 in latex
This allow the use of some utf-8/unicode in the ipynb->latex conversion.

tested in codecell comment and markdown.

Most of the caracter with accent, and thins like squareroot symbol and
so on find their way through until the .tex file, but pdlatex
compilation only works out of the box only with accentuated letters
@fperez fperez Merge pull request #16 from Carreau/unicode-support
somme support for utf-8 in latex conversion.

closes #15
Commits on Jun 02, 2012
@fperez fperez Make codecell a no-op environment to allow page breaks in cells. 9bc14e0
@fperez fperez Fix margins and kerning in listings area. 5e43fb4
Commits on Jun 08, 2012
@jonathan-taylor json2json test class 5b7fd10
@jonathan-taylor overriding DocInherit due to recursion depth errors f8fcd16
@jonathan-taylor simple custom converter c678087
@jonathan-taylor DocInherit is running into recursion depth for subclasses of the orig…
…inal converters -- temporary overwrite
@jonathan-taylor testing roundtrip of test.ipynb file after passing through json.dump/…
@jonathan-taylor removing unnecessary notebook, added a check in render to not reread …
…the file if it has previously been read
@jonathan-taylor last commit did not include change to not reread the fil…
…e -- adding now
@jonathan-taylor added format handlers to capture the various types of display_data 22f9bda
@jonathan-taylor slight reorganizing, grouping the display format methods together, re…
…named _format-> _display_format
@jonathan-taylor checking that we don't return a list like [['blah']] deb4a43
@jonathan-taylor checking latex is returned correctly for LaTeX converter d701d19
@jonathan-taylor resolving small conflict 0af4bfb
Showing with 34 additions and 13 deletions.
  1. +9 −7
  2. +25 −6 preamble.tex
@@ -88,11 +88,11 @@ def markdown2latex(src):
p = subprocess.Popen('pandoc -f markdown -t latex'.split(),
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
- out, err = p.communicate(src)
+ out, err = p.communicate(src.encode('utf-8'))
if err:
print(err, file=sys.stderr)
#print('*'*20+'\n', out, '\n'+'*'*20) # dbg
- return out
+ return unicode(out,'utf-8')
def rst_directive(directive, text=''):
@@ -157,7 +157,7 @@ def convert(self, cell_separator='\n'):
cell_lines = cell_separator.join(converted_cells).split('\n')
- return '\n'.join(lines)
+ return u'\n'.join(lines)
def render(self):
"read, convert, and save self.infile"
@@ -603,12 +603,12 @@ def in_env(self, environment, lines):
Name of the environment to bracket with begin/end.
lines: """
- out = [r'\begin{%s}' % environment]
+ out = [ur'\begin{%s}' % environment]
if isinstance(lines, basestring):
else: # list
- out.append(r'\end{%s}' % environment)
+ out.append(ur'\end{%s}' % environment)
return out
def convert(self):
@@ -661,7 +661,7 @@ def render_code(self, cell):
return []
# Cell codes first carry input code, we use lstlisting for that
- lines = [r'\begin{codecell}']
+ lines = [ur'\begin{codecell}']
self.in_env('lstlisting', cell.input)))
@@ -675,7 +675,7 @@ def render_code(self, cell):
if outlines:
lines.extend(self.in_env('codeoutput', outlines))
- lines.append(r'\end{codecell}')
+ lines.append(ur'\end{codecell}')
return lines
@@ -750,6 +750,8 @@ def render_display_format_latex(self, output):
Returns list.
+ if type(output.latex) == type([]):
+ return output.latex
return [output.latex]
def render_display_format_json(self, output):
31 preamble.tex
@@ -5,6 +5,8 @@
% needed for markdown enumerations to work
@@ -36,10 +38,24 @@
% codecell is the whole input+output set of blocks that a Code cell can
% generate.
- \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
- \MakeFramed{\vspace{-0.5em}\FrameRestore}}
- {\unskip\endMakeFramed}
+% TODO: unfortunately, it seems that using a framed codecell environment breaks
+% the ability of the frames inside of it to be broken across pages. This
+% causes at least the problem of having lots of empty space at the bottom of
+% pages as new frames are moved to the next page, and if a single frame is too
+% long to fit on a page, will completely stop latex from compiling the
+% document. So unless we figure out a solution to this, we'll have to instead
+% leave the codecell env. as empty. I'm keeping the original codecell
+% definition here (a thin vertical bar) for reference, in case we find a
+% solution to the page break issue.
+%% \newenvironment{codecell}{%
+%% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
+%% \MakeFramed{\vspace{-0.5em}}}
+%% {\unskip\endMakeFramed}
+% For now, make this a no-op...
@@ -58,12 +74,14 @@
% Use and configure listings package for nicely formatted code
+ inputencoding=utf8x,
+ extendedchars=\true,
- %xleftmargin=3mm,
+ xleftmargin=2mm,
basicstyle=\small \ttfamily,
@@ -71,6 +89,7 @@
+ columns=fullflexible, % tighter character kerning, like verb
% The hyperref package gives us a pdf with properly built

No commit comments for this range

Something went wrong with that request. Please try again.