Emacs 如何在组织模式导出中按编号引用节?

Emacs 如何在组织模式导出中按编号引用节?,emacs,org-mode,Emacs,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 r

我在组织模式下工作,并试图通过编号而不是标题生成一个链接来引用某个部分

* 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]],
有什么想法吗?

我使用专门的目标:

* 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.
*第一节
*第二节
我可以用[[sec:One]]和[[sec:One][Section One]]引用第一节,
但是我可以得到要解析的实际节号(1)。

这是意料之中的事;请参阅以供参考。

Tom Regner的方法可行,但是,您不必使用专用目标,您仍然可以使用自定义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).

您可以按名称参考章节:

* Section One

* Section Two

* Links
  This is a number link: [[Section One]]
  This is a textual link: [[Section One][Some text for the link]]
以下是乳胶输出:

\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}

嘿,Tom,当我尝试此操作时,专用目标似乎在输出中显示为等。此外,除非我执行类似的操作(setq org export latex hyperref format“\\ref{%s}”),否则行号在latex导出中不会解析。奇怪的是,您使用的是哪个版本的组织模式?我使用8.0.2,emacs24。明天我会检查设置中的变量,但Org8文档建议,在没有特殊设置的情况下,这应该可以正常工作。啊,我使用的是7.9.4。我将升级并在org上检查。如果我编译输出的latex文件,一切都很好。如果我使用org export生成pdf,则参考文件将保留为
。2017年6月3日验证此解决方案与Emacs 25.1.1和org 9.0.6配合使用,非常简单。在动态文本中,或者犯了一个错误,这有一个缺点,即您必须到处更改章节标题,如果需要,根据@York的回答,使用专用目标或自定义_id将该节的链接与其标题分开,从而使更改更容易。