emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.online>
To: "Juan Manuel Macías" <maciaschain@posteo.net>
Cc: Ihor Radchenko <yantar92@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Explicit page breaks
Date: Wed, 28 Sep 2022 20:21:56 -1000	[thread overview]
Message-ID: <87k05melts.fsf@tsdye.online> (raw)
In-Reply-To: <87sfkaague.fsf@posteo.net>

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


  parent reply	other threads:[~2022-09-29  6:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  9:09 Create in Org a bilingual book with facing pages Juan Manuel Macías
2022-09-27 12:29 ` Ihor Radchenko
2022-09-27 16:50   ` Juan Manuel Macías
2022-09-28  3:15     ` Ihor Radchenko
2022-09-28  7:50       ` Explicit page breaks (was: Create in Org a bilingual book with facing pages) Juan Manuel Macías
2022-09-29  3:13         ` Ihor Radchenko
2022-09-29  5:29           ` Explicit page breaks Juan Manuel Macías
2022-09-29  6:05             ` Max Nikulin
2022-09-29  6:21             ` Thomas S. Dye [this message]
2022-10-03  7:14             ` Ihor Radchenko
2022-10-04 20:24               ` Juan Manuel Macías
2022-10-05  7:59                 ` Ihor Radchenko
2022-09-27 16:34 ` Create in Org a bilingual book with facing pages Hendursaga
2022-09-28  6:14   ` Juan Manuel Macías
2022-09-28 14:14     ` Hendursaga
2022-09-28 15:14       ` Juan Manuel Macías
2022-09-28  7:14 ` Christian Moe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k05melts.fsf@tsdye.online \
    --to=tsd@tsdye.online \
    --cc=emacs-orgmode@gnu.org \
    --cc=maciaschain@posteo.net \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).