Skip to content

Commit

Permalink
Merge pull request #73 from damontallen/master
Browse files Browse the repository at this point in the history
Fixes multiple line Latex output of code cells rendering all on one line.
  • Loading branch information
minrk committed Jul 30, 2015
2 parents 4ea1864 + 495f862 commit 0ce3a9a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions nbconvert/templates/latex/base.tplx
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,22 @@ This template does not define a docclass, the inheriting class must define this.

% Display latex
((* block data_latex -*))
((*- if output.data['text/latex'].startswith('$'): -*))
((= Replace $ symbols with more explicit, equation block. =))
\begin{equation*}\adjustbox{max width=\hsize}{$
((( output.data['text/latex'] | strip_dollars )))
$}\end{equation*}
((*- else -*))
((( output.data['text/latex'] )))
((*- endif *))
((*- set Data = output.data['text/latex'].split('$$') -*))
((*- for eq in Data: -*))
((*- set eqs = eq.strip() -*))
((*- if eqs | length >0: -*))
((*- if eqs.startswith('$'): -*))
((= In line equation, not a block =))
((( eqs )))
((*- else: -*))
((= Replace $ symbols with more explicit, equation block. =))
((*- set Eq = '$$' + eqs + '$$' -*))
\begin{equation*}\adjustbox{max width=\hsize}{$
((( Eq | strip_dollars )))
$}\end{equation*}
((*- endif -*))
((*- endif -*))
((*- endfor -*))
((* endblock data_latex *))

% Default mechanism for rendering figures
Expand Down

0 comments on commit 0ce3a9a

Please sign in to comment.