York Zhao <gtdplatf...@gmail.com> writes: >> My understanding is that you need extra machinery to implement >> "ignoreheading" > > I had implemented machinery the "ignoreheading" and posted the code in the > post > "Wrong numbering after removal of headline". But anyways here's my code: > > (defun yz/org-export-process-heading-removal (backend) > "Ignore headlines with tag `ignoreheading'." > (save-excursion > (let ((org-allow-promoting-top-level-subtree t)) > (org-map-entries > (lambda () > (when (member "removeheading" (org-get-local-tags)) > (org-promote-subtree) > (delete-region (line-beginning-position) > (progn (forward-line) (point))))))))) > > (add-hook 'org-export-before-parsing-hook > #'yz/org-export-process-heading-removal) > > This code worked for ignoring the headline with tag "removeheading", and did > re-numbering all the headlines properly. But: > > * Latex New Page :ignoreheading: > #+latex: \newpage > > Still didn't work which I have no idea at this moment yet. Any idea?
So before parsing, you are getting rid of the "ignoreheading" [fn:1] headline (first, "promoting" it to a comment and then deleting the region), so the #+latex: \newpage line now belongs to headline 2 which is then parsed and discarded. I think you need a filter after parsing (which of course conflicts with your need in the "Wrong numbering..." thread). Footnotes: [fn:1] there is a "removeheading" vs "ignoreheading" inconsistency, btw.