usepackage和在ipython笔记本中制作宏 [英] usepackage and making macros in ipython notebook

查看:121
本文介绍了usepackage和在ipython笔记本中制作宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ipython中的降价单元格中呈现的乳胶中包含用户宏和包?

How can user macros and packages be included in the latex rendered in markdown cells in ipython?

例如:

\usepackage{amssymb}
\newcommand{kms}{\ensuremath{\mathrm{km~s}^{-1}}


推荐答案

可以在包含markdown的单元格中定义宏。只需将 \ newcommand 放在 $ 之间:

It is possible to define macros in cells with markdown. Just put the \newcommand between $'s:

$\newcommand{kms}{{\mathrm{km~s}^{-1}}}$

(请注意,我删除了 \ensuremath 命令,因为它无法访问。)

(Note that I removed the \ensuremath command, as it is not accessible.)

在以下任何一个声明中(在整个笔记本中)你可以调用宏(当然只在降价格单元格中):

In any following statement (in the whole notebook) you can call the macro (in a markdown cell only, of course):

$\kms$

我不知道包含额外包裹的方式:(如果你曾经学过如何,我也鼓励你使用 siuntx 打包格式单位。

I do not know a way to include extra packages :( If you ever learn how, I would also encourage you to use the siuntx package to format units.

这篇关于usepackage和在ipython笔记本中制作宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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