diff --git a/IPython/nbconvert/filters/latex.py b/IPython/nbconvert/filters/latex.py index 1942ffb..8936a72 100755 --- a/IPython/nbconvert/filters/latex.py +++ b/IPython/nbconvert/filters/latex.py @@ -22,7 +22,7 @@ import re #Latex substitutions for escaping latex. LATEX_SUBS = ( (re.compile('\033\[[0-9;]+m'),''), # handle console escapes - (re.compile(r'\\'), r'\\textbackslash'), + (re.compile(r'\\'), r'{\\textbackslash}'), (re.compile(r'([{}_#%&$])'), r'\\\1'), (re.compile(r'~'), r'\~{}'), (re.compile(r'\^'), r'\^{}'), diff --git a/IPython/nbconvert/templates/latex/sphinx.tplx b/IPython/nbconvert/templates/latex/sphinx.tplx index adeeb49..ee59ad8 100644 --- a/IPython/nbconvert/templates/latex/sphinx.tplx +++ b/IPython/nbconvert/templates/latex/sphinx.tplx @@ -443,7 +443,7 @@ Note: For best display, use latex syntax highlighting. =)) ((* macro custom_verbatim(text) -*)) \begin{alltt} ((*- if resources.sphinx.centeroutput *))\begin{center} ((* endif -*)) -((( text | wrap_text(wrap_size) ))) +((( text | wrap_text(wrap_size) | escape_latex ))) ((*- if resources.sphinx.centeroutput *))\end{center}((* endif -*)) \end{alltt} ((*- endmacro *))