如何在org-mode导出中按编号引用部分?

时间:2013-05-02 19:56:23

标签: emacs org-mode

我正在org-mode工作并尝试生成一个链接来引用一个部分,而不是它的标题。

* Section One
:PROPERTIES:
:CUSTOM_ID: sec:one
:END:

* Section Two
#+label: sec:two

I can reference Section One with  [[#sec:one]] and [[#sec:one][Section One]],
but I can't get the actual section number (1) to resolve.

我想看看

As you can see in Section 1

写一些像

这样的东西
As you can see in Section [[sec:one]],

有什么想法吗?

3 个答案:

答案 0 :(得分:21)

我使用专用目标

* Section One
  <<sec:one>>

* Section Two
  <<sec:two>>

I can reference Section One with  [[sec:one]] and [[sec:one][Section One]],
but I can get the actual section number (1) to resolve.

这按预期工作;请参阅the orgmode documentation on internal links以供参考。

答案 1 :(得分:5)

Tom Regner的方法有效,但是,您不必使用专用目标,您仍然可以使用custom_id链接,但没有描述。像这样:

* Section One
:PROPERTIES:
:CUSTOM_ID: sec:one
:END:

* Section Two
You can reference Section One with [[#sec:one]] but NOT
[[#sec:one][Section One]], i.e., the link without description
will get you the actual section number (1).

答案 2 :(得分:3)

您可以按名称引用部分:

* Section One

* Section Two

* Links
  This is a number link: [[Section One]]
  This is a textual link: [[Section One][Some text for the link]]

这是LaTeX输出:

\section{Section One}
\label{sec:orgheadline1}

\section{Section Two}
\label{sec:orgheadline2}

\section{Links}
\label{sec:orgheadline3}
This is a number link: \ref{sec:orgheadline1}
This is a textual link: \hyperref[sec:orgheadline1]{Some text for the link}