usepackage和在ipython笔记本中制作宏 [英] usepackage and making macros in ipython notebook
问题描述
如何在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屋!