抑制nb中的部分编号转换为乳胶? [英] suppress section numberings in nbconvert to latex?

查看:83
本文介绍了抑制nb中的部分编号转换为乳胶?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用nbconvert->乳胶-> PDF是否可以抑制节编号?

Is it possible with nbconvert --> latex --> PDF to suppress section numberings?

基本上,我想保留markdown标头语法(#,##等)和ipynb部分标题提供的简单字体大小的区别(nbconvert --to Latex看起来也一样),并且仍然使用这些定义了节标题,但没有编号.然后,我也可以选择手动添加自己的号码.

Essentially I would like to keep the simple font size distinctions that the markdown header syntax (#, ##, etc.), and ipynb section headings provide (nbconvert --to latex appears to treat these same), and still use these to define section headings, but without the numberings. Then I also have the option of adding my own numbers manually.

我可以应付失去一般乳胶文件结构和功能的某些方面.理想情况下,尽管我想保留该信息,并且只隐藏PDF中的编号.

I can cope with losing some aspects of general latex document structuring and functionality. Ideally though I would like to keep that information, and just suppress the numberings in the PDF.

干杯.

推荐答案

您可以简单地使用LaTeX标题标记(部分*,小节*)的加星标版本.
为此,您必须创建一个自定义模板(例如secnum.tplx),该模板如下所示:

You can simply use the stared version of the LaTeX heading tags (section*, subsection*).
To do so, you have to create a custom template (e.g. secnum.tplx) which could look like the following

((*- extends 'latex_article.tplx' -*))

((* block h1 -*))section*((* endblock h1 -*))
((* block h2 -*))subsection*((* endblock h2 -*))
((* block h3 -*))subsubsection*((* endblock h3 -*))
((* block h4 -*))paragraph*((* endblock h4 -*))
((* block h5 -*))subparagraph*((* endblock h5 -*))

对于IPython 2.x:

((*- extends 'article.tplx' -*))

((* block h1 -*))\section*((* endblock h1 -*))
((* block h2 -*))\subsection*((* endblock h2 -*))
((* block h3 -*))\subsubsection*((* endblock h3 -*))
((* block h4 -*))\paragraph*((* endblock h4 -*))
((* block h5 -*))\subparagraph*((* endblock h5 -*))

对于IPython 3.x:

随着IPython 3.x删除了标题单元格类型,这些方法在这里不再适用.

for IPython 3.x:

As IPython 3.x removed the heading cell type these approaches are no longer applicable here.

((* extends 'article.tplx' *))

((* block commands *))
\setcounter{secnumdepth}{0} % Turns off numbering for sections
((( super() )))
((* endblock commands *))

请注意,目录中将不会出现带有星号的标题.
要使用这些模板,请在转换过程中调用它们,例如
ipython nbconvert --to=latex --template=secnum.tplx file.ipynb

Note that stared headings will not be present in the TOC.
To use these templates, call them during the conversion like
ipython nbconvert --to=latex --template=secnum.tplx file.ipynb

这篇关于抑制nb中的部分编号转换为乳胶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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