##// END OF EJS Templates
somme support for utf-8 in latex...
Matthias BUSSONNIER -
Show More
@@ -80,11 +80,11 b' def markdown2latex(src):'
80 80 """
81 81 p = subprocess.Popen('pandoc -f markdown -t latex'.split(),
82 82 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
83 out, err = p.communicate(src)
83 out, err = p.communicate(src.encode('utf-8'))
84 84 if err:
85 85 print(err, file=sys.stderr)
86 86 #print('*'*20+'\n', out, '\n'+'*'*20) # dbg
87 return out
87 return unicode(out,'utf-8')
88 88
89 89
90 90 def rst_directive(directive, text=''):
@@ -139,9 +139,9 b' class Converter(object):'
139 139 if cell.cell_type in ('markdown', 'raw'):
140 140 remove_fake_files_url(cell)
141 141 lines.extend(conv_fn(cell))
142 lines.append('')
142 lines.append(u'')
143 143 lines.extend(self.optional_footer())
144 return '\n'.join(lines)
144 return u'\n'.join(lines)
145 145
146 146 def render(self):
147 147 "read, convert, and save self.infile"
@@ -481,12 +481,12 b' class ConverterLaTeX(Converter):'
481 481 Name of the environment to bracket with begin/end.
482 482
483 483 lines: """
484 out = [r'\begin{%s}' % environment]
484 out = [ur'\begin{%s}' % environment]
485 485 if isinstance(lines, basestring):
486 486 out.append(lines)
487 487 else: # list
488 488 out.extend(lines)
489 out.append(r'\end{%s}' % environment)
489 out.append(ur'\end{%s}' % environment)
490 490 return out
491 491
492 492 def convert(self):
@@ -539,7 +539,7 b' class ConverterLaTeX(Converter):'
539 539 return []
540 540
541 541 # Cell codes first carry input code, we use lstlisting for that
542 lines = [r'\begin{codecell}']
542 lines = [ur'\begin{codecell}']
543 543
544 544 lines.extend(self.in_env('codeinput',
545 545 self.in_env('lstlisting', cell.input)))
@@ -553,7 +553,7 b' class ConverterLaTeX(Converter):'
553 553 if outlines:
554 554 lines.extend(self.in_env('codeoutput', outlines))
555 555
556 lines.append(r'\end{codecell}')
556 lines.append(ur'\end{codecell}')
557 557
558 558 return lines
559 559
@@ -5,6 +5,8 b''
5 5 \usepackage{amsmath}
6 6 \usepackage{amssymb}
7 7 \usepackage{graphicx}
8 \usepackage{ucs}
9 \usepackage[utf8x]{inputenc}
8 10
9 11 % needed for markdown enumerations to work
10 12 \usepackage{enumerate}
@@ -58,9 +60,11 b''
58 60 {\endMakeFramed}
59 61
60 62 % Use and configure listings package for nicely formatted code
61 \usepackage{listings}
63 \usepackage{listingsutf8}
62 64 \lstset{
63 65 language=python,
66 inputencoding=utf8x,
67 extendedchars=\true,
64 68 aboveskip=\smallskipamount,
65 69 belowskip=\smallskipamount,
66 70 %xleftmargin=3mm,
General Comments 0
You need to be logged in to leave comments. Login now