emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Explicit page breaks


From: Thomas S. Dye
Subject: Re: Explicit page breaks
Date: Wed, 28 Sep 2022 20:21:56 -1000
User-agent: mu4e 1.6.10; emacs 27.1

Aloha all,

Juan Manuel Macías <maciaschain@posteo.net> writes:

Ihor Radchenko writes:

Do note that page breaks may or may not lay between paragraphs or Org elements. By its nature, page break is an object (in Org terminology).

Indeed, page break can be placed anywhere. But inserting it before
paragraphs, at least in Org, is the least compromised by the
idiosyncrasies of each format: odt or LaTeX. And the most
format-agnostic. And on the other hand, in LaTeX and odt it's also the safest place to put them, unless you want to add some fine-tuning in
either case.


This doesn't reach to paragraphs, but tags do a good job of inserting \clearpage and \newpage before a section heading in LaTeX export.
****** Rasmus filter headline tags

This function was improved by Rasmus Pank Roulund based on one I had
cobbled together from pieces posted on the Org mode mailing list.

#+name: rpr-filter-headline-tags
#+begin_src emacs-lisp :results silent
(defun tsd-filter-headline-tags (contents backend info)
 "Ignore headlines with tag `ignoreheading' and/or start LaTeX
 section with `newpage' or `clearpage' command."
 (cond ((and (org-export-derived-backend-p backend 'latex)
              (string-match "\\`.*newpage.*\n" (downcase contents))
              ;; if you want to get rid of labels use the string
              ;; "\\`.*ignoreheading.*\n.*\n"
(string-match "\\`.*ignoreheading.*\n" (downcase contents)))
         (replace-match "\\\\newpage\n" nil nil contents))
        ((and (org-export-derived-backend-p backend 'latex)
              (string-match "\\`.*clearpage.*\n" (downcase contents))
(string-match "\\`.*ignoreheading.*\n" (downcase contents)))
         (replace-match "\\\\clearpage\n" nil nil contents))
        ((and (org-export-derived-backend-p backend 'latex 'html 'ascii)
(string-match "\\`.*ignoreheading.*\n" (downcase contents)))
         (replace-match "" nil nil contents))
        ((and (org-export-derived-backend-p backend 'latex)
(string-match "\\(\\`.*?\\)\\(?:\\\\hfill{}\\)?\\\\textsc{.*?newpage.*?}\\(.*\n\\)"
                            (downcase contents)))
         (replace-match "\\\\newpage\n\\1\\2"  nil nil contents))
        ((and (org-export-derived-backend-p backend 'latex)
(string-match "\\(\\`.*?\\)\\(?:\\\\hfill{}\\)?\\\\textsc{.*?clearpage.*?}\\(.*\n\\)" (downcase contents)))
         (replace-match "\\\\clearpage\n\\1\\2"  nil nil contents))))
#+end_src

Hope this helps. If not, sorry for the noise.

All the best,
Tom

--
Thomas S. Dye
https://tsdye.online/tsdye



reply via email to

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