组织模式包括标题 [英] Org Mode include heading

查看:129
本文介绍了组织模式包括标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用组织模式来撰写论文和幻灯片。生成表和图形的代码放在源块中。大多数情况下,我在我的论文中使用与幻灯片相同的表格,但需要大量的预处理代码来生成表格。我想将这些表的一代放在自己的组织模式文件中,并且可以在纸张或幻灯片文档中包含某些标题。例如,我将有一个名为mytables.org的组织模式文档:

  *标题1 
**回归
#+ BEGIN_SRC R
cat(hello world)
#+ END_SRC R
*标题2

另一个文件mypaper.org:

  *第1节
#+ INCLUDE:mytables.org:标题标题1 /回归
*第2节

mytables.org中的回归标题下方的内容将包含在mypaper.org的导出中。能够使用C-c'来遵循INCLUDE文件也是非常好的。组织为这些包含提供了一些设施,但不允许标题( http://orgmode.org/ manual / Include-files.html )。显然,org没有:heading参数,但是对于解决这个问题的任何建议是非常感激的。



谢谢。

解决方案

组织模式8.3 支持这(我使用 8.3beta )。例如:

 #+ INCLUDE:./paper .org :: *结论:行1-20 

将包含标题的前20行命名结论。



另外,要包含一个标题,它的 CUSTOM_ID 属性(假设它是 Sec:简介):

 #+ INCLUDE:./paper.org::# Sec:简介

我发现:only-contents t 适用于我的应用程序(我包含一个来自另一个 org 文件的子树来进行演示):

 #+ INCLUDE:./paper.org::*conclusion:only-contents t 


I use org-mode to write both papers and slides. The code to generate tables and figures is placed in source blocks. Most of the time I use the same tables in my slides as in my papers, but a lot of preprocessing code is needed to generate the tables. I'd like to put the generation of these tables in its own org-mode file and just be able to include certain headings in the paper or slide document. For example, I would have an org-mode document called mytables.org:

* Heading 1
** Regressions
#+BEGIN_SRC R
cat("hello world")
#+END_SRC R
* Heading 2

And another document mypaper.org:

* Section 1
#+INCLUDE: "mytables.org" :heading "Heading 1/Regressions"
* Section 2

The content from below the ** Regression headline in mytables.org would be included on export in mypaper.org. It would also be great to be able to follow the INCLUDE to the file with C-c '. Org provides some facilities for these includes, but does not allow for headings ( http://orgmode.org/manual/Include-files.html ). Obviously org does not have the :heading parameter, but any suggestions for a solution to make this work are greatly appreciated.

Thanks.

解决方案

Org mode 8.3 supports this (I'm using 8.3beta).

For example:

#+INCLUDE: "./paper.org::*conclusion" :lines 1-20

will include the first 20 lines of the headline named conclusion.

Also, to include a heading by its CUSTOM_ID property (suppose it is Sec: Introduction):

#+INCLUDE: "./paper.org::#Sec: Introduction"

I found :only-contents t works well for my application (I'm including a subtree from another org file for a beamer presentation):

#+INCLUDE: "./paper.org::*conclusion" :only-contents t

这篇关于组织模式包括标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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