emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Wrong numbering after removal of headline


From: York Zhao
Subject: [O] Wrong numbering after removal of headline
Date: Mon, 30 Jun 2014 15:02:07 -0400

Hi list,

As an example, I have the follow org-mode buffer:

* Level1
** Level2
*** Level3

If I export this to LaTeX (C-x C-e l p), it produces the following:

--8<---------------cut here---------------start------------->8---

Contents

1 Level1
1.1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . .

--8<---------------cut here---------------end--------------->8---

Which is good. However, since what I need is that I don't want to produce the
"level1" heading, so I added the following code:

(defun yz/org-export-ignore-headline (contents backend info)
  "Ignore headlines with tag `ignoreheading'."
  (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
             (string-match "\\`.*ignoreheading.*\n" (downcase contents)))
    (replace-match "" nil nil contents)))

(add-to-list 'org-export-filter-headline-functions
             'yz/org-export-ignore-headline)

And I added tag "ignorheading" to the "Level1" heading. It works and produced:

--8<---------------cut here---------------start------------->8---

0.1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . .

--8<---------------cut here---------------end--------------->8---

However, the headline numbering now starts from 0 which is wrong , what I want
is:

1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . .

Can anyone please tell me how I could achieve this?

Thanks in advance

York



reply via email to

[Prev in Thread] Current Thread [Next in Thread]