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: Thu, 3 Jul 2014 12:55:12 -0400

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



reply via email to

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