From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Zhao Subject: Re: Force new page on exporting Date: Tue, 1 Jul 2014 14:22:08 -0400 Message-ID: References: <87k37xaygu.fsf@alphaville.bos.redhat.com> <87bnt9aw2x.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X22h0-0006rB-Jc for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 14:22:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X22gz-0008On-5Z for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 14:22:10 -0400 Received: from mail-ve0-x22c.google.com ([2607:f8b0:400c:c01::22c]:54019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X22gz-0008OU-1L for emacs-orgmode@gnu.org; Tue, 01 Jul 2014 14:22:09 -0400 Received: by mail-ve0-f172.google.com with SMTP id jz11so10055775veb.31 for ; Tue, 01 Jul 2014 11:22:08 -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 OK, hacked `org-export-filter-headline-functions' and added the facility to force exporting a headline on new page by adding a new tag "newpage" to the headline. Here is the code: (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 "^\\\\section{.*\\(\\\\.*{newpage}\\).*\n" 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)))))))) (add-to-list 'org-export-filter-headline-functions #'yz/org-export-headline-on-new-page)