From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook Date: Thu, 9 Feb 2017 02:58:40 +0000 Message-ID: References: , <877f50f918.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_CY4PR15MB162220D13B56950184DED64FEB450CY4PR15MB1622namp_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbewa-0005Hf-QF for emacs-orgmode@gnu.org; Wed, 08 Feb 2017 21:58:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbewV-0008Ud-T3 for emacs-orgmode@gnu.org; Wed, 08 Feb 2017 21:58:48 -0500 Received: from bay004-omc4s8.hotmail.com ([65.54.190.210]:53339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbewV-0008UM-98 for emacs-orgmode@gnu.org; Wed, 08 Feb 2017 21:58:43 -0500 In-Reply-To: <877f50f918.fsf@alphaville.usersys.redhat.com> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nick Dokos , "emacs-orgmode@gnu.org" --_000_CY4PR15MB162220D13B56950184DED64FEB450CY4PR15MB1622namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > So you'll have to manipulate org-map-continue-from appropriately. Thanks a lot! Adding (setq org-map-continue-from (outline-next-heading)) af= ter insert-string seemed to solve the problem. (I added "newpage" to org-tags-exclude-from-inheritance, so the newpage doe= s 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 --_000_CY4PR15MB162220D13B56950184DED64FEB450CY4PR15MB1622namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

So you'll have to manipulate org-map-continue-from appropriately= .


Thanks a lot! Adding (setq org-map-continue-from (outli= ne-next-heading)) after insert-string seemed to solve the problem. 
(I added "newpage" to&nbs= p;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 "#+LA= TEX: \\newpage\n")
           (setq org-map-continue-from (= outline-next-heading))
           ))
       "+newpage"))
)

(add-hook 'org-export-before-parsing-hook 'org/parse-headings-latex-ne= wpage)
(add-to-list 'org-tags-exclude-from-inheritance '"newpage")<= /div>

Best,
Joon
--_000_CY4PR15MB162220D13B56950184DED64FEB450CY4PR15MB1622namp_--