> So you'll have to manipulate org-map-continue-from appropriately.
Thanks a lot! Adding (setq org-map-continue-from (outline-next-heading)) after
insert-string seemed to solve the problem.
(I added "newpage" to org-tags-exclude-from-inheritance, so the newpage does
not get applied to subheadings)
(defun org/parse-headings-latex-newpage (backend)
; add \newpage to headings with :newpage: tag
(if (member backend '(latex))
(org-map-entries
(lambda ()
(progn
(insert-string "#+LATEX: \\newpage\n")
(setq org-map-continue-from (outline-next-heading))
))
"+newpage"))
)
(add-hook 'org-export-before-parsing-hook 'org/parse-headings-latex-newpage)
(add-to-list 'org-tags-exclude-from-inheritance '"newpage")
Best,
Joon