【问题标题】:IPython Syntax Lexer for Latex Minted Package用于 Latex Minted 包的 IPython 语法词法分析器
【发布时间】:2014-01-01 23:09:52
【问题描述】:

有没有办法使用例如 minted 包 (https://github.com/gpoore/minted) 将带有语法突出显示的 IPython 会话集成到乳胶文档中?

我见过许多使用 nbconvert 将笔记本转换为 tex 文件的方法。但是我不想在笔记本环境中编写整个文档。但是,我想将 IPython 示例合并到我的论文中。

类似:

\begin{minted}{ipython ....}
IN[1]: import pandas as pd
...
\end{minted}

【问题讨论】:

  • IPython 控制台示例有 Sphinx 荧光笔,Sphinx 可以生成 Latex 输出。但是,如果您是手动编写 Latex,您可能不喜欢生成的 Latex。
  • 好主意。我看了写 RST 然后通过 Sphinx 解析它,但如果可能的话,我想用 Latex 写,因为其他所有东西都是用 Latex 写的。
  • 这可以通过将 ipython-console-highlighting 添加到 Pygments 来完成。然后ipython会流过minted并被Pygments识别

标签: latex ipython tex


【解决方案1】:

这就是我所做的,只是将 IPython 控制台编写器注入到 Pygments 中。

https://github.com/sanguineturtle/pygments-ipython-console

【讨论】:

    猜你喜欢
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 2012-03-12
    • 2023-03-06
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    相关资源
    最近更新 更多