In the file articles.tplx in ~/.jupyter/templates folder (if the file or folder doesn't exist we can create it)
% Default to the notebook output style
((* if not cell_style is defined *))
((* set cell_style = 'style_ipython.tplx' *))
((* endif *))
% Inherit from the specified cell style.
((* extends cell_style *))
%===============================================================================
% Latex Article
%===============================================================================
((* block docclass *))
\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{everypage}
\makeatletter
\global\let\tikz@ensure@dollar@catcode=\relax
\makeatother
\AddEverypageHook{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=-20pt,xshift=-30pt] at (current page.north east)
{\includegraphics{logo.png}};
\end{tikzpicture}}
((* endblock docclass *))
To use the custom template we can compile to PDF with:
jupyter nbconvert --to=pdf --PdfExporter.template_file=~/.jupyter/templates/article.tplx notebook.ipynb
This case is a little more complex, we need to change a package added in the base template file.
At the beginning of this file we can see that the file called style_ipython.tplx
is extended.
And this file extends a file called base.tplx
we can search this file using the terminal (or finder).
In my case the file was in: ~/miniconda3/lib/python3.6/site-packages/nbconvert/templates/latex/base.tplx
We need to remove the pacakge that cause the problem.
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
And add a new one for the support of UTF-8
\usepackage{listings,fontspec}