From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Zhao Subject: Re: Force new page on exporting Date: Thu, 3 Jul 2014 12:55:12 -0400 Message-ID: References: <87k37xaygu.fsf@alphaville.bos.redhat.com> <87bnt9aw2x.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b44fcba4ed27404fd4cdf72 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2kHy-0001SA-Bx for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 12:55:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2kHx-00006x-Ez for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 12:55:14 -0400 Received: from mail-ve0-x230.google.com ([2607:f8b0:400c:c01::230]:53847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2kHx-00006r-Az for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 12:55:13 -0400 Received: by mail-ve0-f176.google.com with SMTP id db12so526922veb.7 for ; Thu, 03 Jul 2014 09:55:12 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: emacs-orgmode --047d7b44fcba4ed27404fd4cdf72 Content-Type: text/plain; charset=UTF-8 Thought I should post an update to fix a regexp problem, hopfully somebody else will find it useful. (defun yz/org-export-headline-on-new-page (contents backend info) "Export headlines with tag `newpage' on new pages." (when (org-export-derived-backend-p backend 'latex) (with-temp-buffer (insert contents) (goto-char (point-min)) (let ((case-fold-search t)) (when (re-search-forward "^\\\\\\(?:sub\\)?section{.*\\(\\\\.*{newpage}\\).*$" nil 'noerror) (replace-match "" nil nil nil 1) ; Delete the "newpage" tag (forward-line -1) (insert "\\newpage\n") (setq contents (buffer-substring (point-min) (point-max)))))))) York --047d7b44fcba4ed27404fd4cdf72 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thought = I should post an update to fix a regexp problem, hopfully somebody else
= will find it useful.

(defun yz/org-export-headline-on-new-page (cont= ents backend info)
=C2=A0 "Export headlines with tag `newpage' on new pages."=C2=A0 (when (org-export-derived-backend-p backend 'latex)
=C2=A0 = =C2=A0 (with-temp-buffer
=C2=A0 =C2=A0 =C2=A0 (insert contents)
=C2= =A0 =C2=A0 =C2=A0 (goto-char (point-min))
=C2=A0 =C2=A0 =C2=A0 (let ((ca= se-fold-search t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (re-search-forward
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"^\\\\\\(?:sub\\)?section{.*\\(\= \\\.*{newpage}\\).*$"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0nil 'noerror)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (replace-= match "" nil nil nil 1) ; Delete the "newpage" tag
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (forward-line -1)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (insert "\\newpage\n")
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (setq contents (buffer-substring (point-min) (point-max))))))= ))

York


--047d7b44fcba4ed27404fd4cdf72--