Jupyter 笔记本:如何为 LaTeX usepackage{} [英] Jupyter notebook: How to usepackage{} for LaTeX

查看:44
本文介绍了Jupyter 笔记本:如何为 LaTeX usepackage{}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在 Jupyter 笔记本中 usepackage{} 用于 LaTeX.

I would like to know how I can usepackage{} for LaTeX in Jupyter notebook.

推荐答案

不确定这是唯一的还是最好的方法,但它似乎有效.在与 ipynb 笔记本文件(mynotebook.ipynb")相同的目录中编写模板文件(mytemplate.tplx").mytemplate.tplx 看起来像:

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 *))

通过执行以下操作构建您的 pdf LaTex 文件:

Build your pdf LaTex file by executing the following:

jupyter nbconvert mynotebook.ipynb --to latex --template mytemplate.tplx
pdflatex mynotebook.tex

这篇关于Jupyter 笔记本:如何为 LaTeX usepackage{}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆