[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Wrong numbering after removal of headline
From: |
Thomas S. Dye |
Subject: |
Re: [O] Wrong numbering after removal of headline |
Date: |
Mon, 30 Jun 2014 11:37:07 -1000 |
M-S-left with point on the Level2 heading?
Tom
York Zhao <address@hidden> writes:
>> You could promote the Level2 subtree.
>
> I had thought about this, but I don't think this will be trivial.
>
> On Mon, Jun 30, 2014 at 3:37 PM, Thomas S. Dye <address@hidden> wrote:
>> Aloha York,
>>
>> York Zhao <address@hidden> writes:
>>
>>> 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:
>>>
>>>
>>> Contents
>>>
>>> 1 Level1
>>> 1.1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> 1.1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>
>>>
>>> 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:
>>>
>>>
>>> 0.1 Level2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> 0.1.1 Level3 . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>
>>>
>>> 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?
>>
>> You could promote the Level2 subtree.
>>
>> hth,
>> Tom
>>
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>
>
--
Thomas S. Dye
http://www.tsdye.com