Export org-mode to latex - suppress tag generation

I use org-mode to write a report, which I then export to LaTeX. I have several different .org files (one for each chapter) that I export as a "headless" LaTeX, and then merge into a master .tex file. This works well, except that the generated .tex files contain labels with conflicting numbers. Thus, both a.tex and b.tex contain \label{sec-1} , for example.

As long as I never use these links, this is not a problem, I think, although the warnings annoy me. Is there a way to disable the creation of these labels? It should be simple, but I can not find anything about it in the documentation.

+4
source share
2 answers

Why not write a full report as one big Org file?

In any case, if you prefer to have several smaller files, I would advise you to "include" them in one main Org file, like this:

 * Chapter 1 #+INCLUDE: "chapter1.org" * Chapter 2 #+INCLUDE: "chapter2.org" 

This way, Org sees only one file (then, I think, your problem just disappears), while you edit them as you wish.

+4
source

I wrote a little Lisp that will remove the specified labels after exporting to LaTeX, which looks like this:

 (defun remove-orgmode-latex-labels () "Remove labels generated by org-mode" (interactive) (let ((case-fold-search nil)) (goto-char 1) (replace-regexp "\\\\label{sec-[0-9][^}]*}" "") ) ) (add-hook 'org-export-latex-final-hook 'remove-orgmode-latex-labels) 

It seems that this work is being done without removing its own shortcuts.

+3
source

Source: https://habr.com/ru/post/1495489/


All Articles