org 导出到tex时,为什么我的sec是随机ID,而有人是编号?

我看到有人的 sec是 自动编号 如 sec-1,sec-2-1等等,这里:




When this variable is non-nil, Org will use the value of CUSTOM_ID property, NAME keyword or Org target as the key for the \label commands generated.

By default, Org generates its own internal labels during LaTeX export. This process ensures that the \label keys are unique and valid, but it means the keys are not available in advance of the export process.

For headlines that do not define the CUSTOM_ID property or elements without a NAME, Org will continue to use its default labeling scheme to generate labels and resolve links into proper references.

我是不想手工设置 custom-id,但是不管 org-latex-prefer-user-labels 是nil还是t,都达不到上面老外帖子里的效果。

stackexchange 上的是8.*的版本,比较老。现在的版本为了确保生成的引用是唯一的,用的是随机数

(defun org-export-new-reference (references)
  "Return a unique reference, among REFERENCES.
REFERENCES is an alist whose values are in-use references, as
numbers.  Returns a number, which is the internal representation
of a reference.  See also `org-export-format-reference'."
  ;; Generate random 7 digits hexadecimal numbers.  Collisions
  ;; increase exponentially with the numbers of references.  However,
  ;; the odds for encountering at least one collision with 1000 active
  ;; references in the same document are roughly 0.2%, so this
  ;; shouldn't be the bottleneck.
  (let ((new (random #x10000000)))
    (while (rassq new references) (setq new (random #x10000000)))