emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Adding #+LATEX: \newpage before section header using org-export-


From: Joon Ro
Subject: Re: [O] Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook
Date: Sat, 11 Feb 2017 19:40:10 +0000

I spoke too early - if I have two headings with :newpage: tag in a row, my current code below skips the second heading. 

It seems (setq org-map-continue-from (outline-next-heading)) in my code is the problem .. any help will be appreciated!



(defun org/parse-headings-newpage (backend)
  ; add \newpage to headings with :newpage: tag
  (if (member backend '(latex))
      (org-map-entries
       (lambda ()
         (insert-string "#+LATEX: \\newpage\n")
         (if (outline-next-heading)
           (setq org-map-continue-from (outline-next-heading)))
         )
       "+newpage"))
)

(add-hook 'org-export-before-parsing-hook 'org/parse-headings-newpage)



From: Emacs-orgmode <emacs-orgmode-bounces+address@hidden> on behalf of Joon Ro <address@hidden>
Sent: Wednesday, February 8, 2017 8:58:40 PM
To: Nick Dokos; address@hidden
Subject: Re: [O] Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook
 

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

reply via email to

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