diff --git a/nbconvert/exporters/templateexporter.py b/nbconvert/exporters/templateexporter.py index 4430a402f..1178ed388 100644 --- a/nbconvert/exporters/templateexporter.py +++ b/nbconvert/exporters/templateexporter.py @@ -320,6 +320,7 @@ def from_notebook_node(self, nb, resources=None, **kw): # Top level variables are passed to the template_exporter here. output = self.template.render(nb=nb_copy, resources=resources) + output = output.lstrip('\r\n') return output, resources def _register_filter(self, environ, name, jinja_filter): diff --git a/nbconvert/templates/latex/article.tplx b/nbconvert/templates/latex/article.tplx index 8588c850c..b87a7ff18 100644 --- a/nbconvert/templates/latex/article.tplx +++ b/nbconvert/templates/latex/article.tplx @@ -1,8 +1,8 @@ ((=- Default to the notebook output style -=)) -((* if not cell_style is defined *)) +((*- if not cell_style is defined -*)) ((* set cell_style = 'style_jupyter.tplx' *)) -((* endif *)) +((*- endif -*)) ((=- Inherit from the specified cell style. -=)) ((* extends cell_style *)) @@ -12,6 +12,6 @@ % Latex Article %=============================================================================== -((* block docclass *)) +((*- block docclass -*)) \documentclass[11pt]{article} -((* endblock docclass *)) +((*- endblock docclass -*)) diff --git a/nbconvert/templates/latex/base.tplx b/nbconvert/templates/latex/base.tplx index 5281c63a4..41b7902f7 100644 --- a/nbconvert/templates/latex/base.tplx +++ b/nbconvert/templates/latex/base.tplx @@ -1,7 +1,8 @@ -((= Latex base template (must inherit) +((=- Latex base template (must inherit) This template builds upon the abstract template, adding common latex output -functions. Figures, data_text, -This template does not define a docclass, the inheriting class must define this.=)) +functions. Figures, data_text, +This template defines defines a default docclass, the inheriting class should +override this.-=)) ((*- extends 'document_contents.tplx' -*)) @@ -9,9 +10,9 @@ This template does not define a docclass, the inheriting class must define this. % Abstract overrides %=============================================================================== -((* block header *)) - ((* block docclass *))((* endblock docclass *)) - +((*- block header -*)) + ((* block docclass *))\documentclass[11pt]{article}((* endblock docclass *)) + ((* block packages *)) \usepackage{iftex} \ifPDFTeX @@ -179,8 +180,7 @@ This template does not define a docclass, the inheriting class must define this. ((* endblock header *)) ((* block body *)) - \begin{document} - +\begin{document} ((* block predoc *)) ((* block maketitle *))\maketitle((* endblock maketitle *)) ((* block abstract *))((* endblock abstract *)) @@ -192,5 +192,5 @@ This template does not define a docclass, the inheriting class must define this. ((* block postdoc *)) ((* block bibliography *))((* endblock bibliography *)) ((* endblock postdoc *)) - \end{document} +\end{document} ((* endblock body *)) diff --git a/nbconvert/templates/latex/skeleton/null.tplx b/nbconvert/templates/latex/skeleton/null.tplx index 398d7ed13..c9c380381 100644 --- a/nbconvert/templates/latex/skeleton/null.tplx +++ b/nbconvert/templates/latex/skeleton/null.tplx @@ -1,5 +1,5 @@ -((= Auto-generated template file, DO NOT edit directly! - To edit this file, please refer to ../../skeleton/README.md =)) +((=- Auto-generated template file, DO NOT edit directly! + To edit this file, please refer to ../../skeleton/README.md -=)) ((= diff --git a/nbconvert/templates/skeleton/Makefile b/nbconvert/templates/skeleton/Makefile index c02ac0fe7..65b9ade66 100644 --- a/nbconvert/templates/skeleton/Makefile +++ b/nbconvert/templates/skeleton/Makefile @@ -6,9 +6,9 @@ all: clean $(TPLS) # see http://flask.pocoo.org/snippets/55/ for more info ../latex/skeleton/%.tplx: %.tpl @echo 'generating tex equivalent of $^: $@' - @echo '((= Auto-generated template file, DO NOT edit directly!\n' \ + @echo '((=- Auto-generated template file, DO NOT edit directly!\n' \ ' To edit this file, please refer to ../../skeleton/README.md' \ - '=))\n\n' > $@ + '-=))\n\n' > $@ @sed \ -e 's/{%/((*/g' \ -e 's/%}/*))/g' \