ipynb-tex

Include Jupyter notebook cells in TeX documents
授权协议 Readme
开发语言
所属分类 企业应用、 LaTeX排版系统
软件类型 开源软件
地区 不详
投 递 者 穆浩皛
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ipynb-tex.sty

ipynb-tex is a simple style sheet which allows you to extract tagged cells out of a Jupyter notebook and include them in a TeX document

Rather than save output or copies of source code to insert into TeX docs, ipynb-tex always inserts the latest cells from your notebooks directly into TeX files.

Installation

In your main document directory, just make a symlink to the ipynb-tex.sty file.

ln -s /path/to/ipynb-tex/ipynb-tex.sty

Include cells in your .tex document

Command Description
\ipynbsource{notebook}[tag] Include the source from all cells sharing the tag "example".
\ipynboutput{notebook}[tag] Include the output from all cells sharing the tag "example".
\ipynb{notebook}[tag] Include the source and output from all cells sharing the tag "example".
\ipynbimage{notebook}[tag] Include an image
\ipynbtex{notebook}[tag] Include raw TeX output

Compile LaTeX

ipynb-tex uses PythonTeX to execute the cell extraction code. So, just as with PythonTeX, you'll need to execute pythontex as part of your document build. Also include --shell-escape to allow external functions to be called correctly.

pdflatex --shell-escape document.tex    #scan the document, figure out what Python needs to be executed
pythontex --rerun=always document       #executes the Python found in the document
pdflatex --shell-escape document.tex    #include any valid TeX printed from the Python execution
pdflatex --shell-escape document.tex    #ensure any included references are correctly handled

Tagging cells in a notebook

Toggle the toolbar UI

Tag a cell

Modifying this plugin

This repo comes with a ready to go version of ipynb-tex.sty, but if you want to make changes and rebuild it just run ./build, which merges ipynb-tex-template.sty and extract_cells.py to create ipynb-tex.sty.

There are no package dependencies required to run this script, but to execute the sample you'll need to include a set of dependencies.

pip install -r requirements.txt

Running Tests

pip install nose
nosetests

Todo

  • Remove the need to "rerun=always", by registering the [filename].ipynb as a dependency while pythontex is running.
  • Export cells only once, by making an in-memory variable which tags a file as already processed, to avoid repeated work.
  • Add a \ipynbdirectory which serves as the base path for all notebooks, so if you're compiling a doc with lots, no need to keep including the path
  • https://cloud.tencent.com/developer/article/1008571 ipynb转为html格式 在Ubuntu命令行输入: jupyter nbconvert --to html notebook.ipynb 另外,jupyter提供了一些命令,可以对生成的html格式进行配置: jupyter nbconvert --to html --template fu

  • 插件安装 nbconvert pandoc miktex 一系列宏包  配置环境变量后一定要关闭命令行再重新启动notebook,否则path没有生效 图像编译问题 jupyter notebook notebook.tex:403: Unable to load picture or PDF file ’ 解决  将想要加载到latex文件中的图片下载到本地(与ipynb文件),同时注意文件名与

  • 下载并安装 texlive,选择.iso下载(4G+),然后解压,右键管理员运行install-tl-windows.bat,选择安装路径后按默认设置安装即可; VScode扩展商店中,安装LaTex和LaTex Workshop; VScode中F1,键入“open setting”,搜索“首选项-打开设置(json)”,在打开的settings.json中输入如下跟LaTex配置相关的内容:

  • 使用jupyter notebook文件直接生成pdf时,不会显示中文。可采用如下方式解决: 在命令行安装MiKTex:pip install MiKTex,下载地址:Getting MiKTeX 在jupyter notebook下将 .ipynb 导出为 .tex(LaTex文件) 手动修改 .tex文件,增加中文支持: 在\documentclass{article}后面插入: \usepa

 相关资料
  • ipynb-quicklook Note: This plugin has now been integrated into a native macOS app,Jupyter Notebook Viewer. A stand-alone Quick Look generatorfor Jupyter/IPython notebooks onmacOS. Contents are rendere

  • 我对Jupyter笔记本相当陌生。我已经玩了一段时间了。但这是我第一次尝试将另一个笔记本导入我的主课堂。 作为参考,我使用的是 Anaconda 4.3.1 和 Python v2.7。 我试图将我在python项目中所做的复制到jupyter笔记本上。它需要导入其他。ipynb文件(翻译自原文。py文件)中,以便根据需要使用相关方法。 为此,我按照Jupyter Nbviewer步骤链接上给出的

  • 我有一个小的基本问题。我用的是Mac电脑,我以前在办公室工作。py文件与升华3。我喜欢的一件事是,当Sublime关闭时,对于文件夹中的给定文件——如果我在寻找一些代码——我可以点击空格键,Mac电脑可以快速预览文件。py文件。 现在我在Jupyter笔记本中工作,并将所有内容保存为. ipynb文件。现在我不能点击空格键和浏览文件——我从命令区启动JN,它要慢得多。 我怀疑有更快的方法在浏览器窗

  • 问题内容: 我正在使用Python笔记本工作,我希望将 大型输入代码[input] 打包到[* .PY]文件中,然后从Notebook调用此文件 。 我知道从笔记本 *中运行[ .PY]文件_ 的操作, 该命令在Linux或Windows之间有所不同。 _ *但是当我执行此操作并从笔记本计算机执行[.PY]文件时,它无法识别笔记本计算机中加载的任何现有库或变量(就像[ .PY]文件从零开始…)。

  • 在我的设置中。json,我有 但这些尺子也出现在我所有的Jupyter笔记本中,这不是我想要的。 我怎样才能使这些免于显示标尺? 附:在关于统治者的主要文章中,到目前为止还没有这样的答案: Visual Studio Code中的垂直标尺 根据文件类型在vscode中设置垂直标尺?

  • 我正在Google Dataproc集群上的Jupyter Notebook上工作。当您使用笔记本时,它会在每个单元格的执行上给出输出。 我必须在集群上提交PySpark作业。作业将. py文件作为输入。下面附上截图 当我进入一条小路。ipynb文件它给出了以下错误。 线程“main”组织中出现异常。阿帕奇。火花SparkException:无法从JAR文件加载主类:/tmp/job-e48114

相关阅读

相关文章

相关问答

相关文档