emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Force new page on exporting


From: York Zhao
Subject: Re: [O] Force new page on exporting
Date: Tue, 1 Jul 2014 14:22:08 -0400

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)



reply via email to

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