问题
I would like to know how I can \usepackage{} for LaTeX in Jupyter notebook.
回答1:
Not sure this is the only or even best way of doing it, but it seems to work. Write a template file ("mytemplate.tplx") in the same directory as your ipynb notebook file ("mynotebook.ipynb"). mytemplate.tplx looks like:
((*- extends 'article.tplx' -*))
((* block packages *))
((( super() )))
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
((* endblock packages *))
Build your pdf LaTex file by executing the following:
jupyter nbconvert mynotebook.ipynb --to latex --template mytemplate.tplx
pdflatex mynotebook.tex
来源:https://stackoverflow.com/questions/40448200/jupyter-notebook-how-to-usepackage-for-latex