emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: End Section with \clearpage
Date: Wed, 21 Jan 2015 10:25:20 +0100	[thread overview]
Message-ID: <m2twzktri7.fsf@krugs.de> (raw)
In-Reply-To: <87k30r6kbh.fsf@gmx.us> (rasmus@gmx.us's message of "Tue, 13 Jan 2015 11:34:10 +0100")

[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]

Rasmus <rasmus@gmx.us> writes:

> Hi,
>
> Rainer M Krug <Rainer@krugs.de> writes:
>
>> I want to add after some sections a \clearpage which works, But the
>> \clearpage is part of the last header:
>>
>> ,----
>> | * Subsection to be ended with clearpage
>> | ** Sub-section
>> | some text
>> | *** sub-sub-section
>> | Some more text
>> | 
>> | \clearpage
>> | 
>> | * Next Subsection
>> | * Last subsection
>> `----
>>
>> Is there a way that I can add this \clearpage at the end of the section
>> *without* being in the last subsection?
>>
>> I guess not?
>
> Use a org-export-filter-section-functions filter to insert "\clearpage" at
> the end on headlines with the appropriate property or tag.  A quick hack:
>
> (defun rasmus/get-org-headline-string-element  (headline backend info)
>   "Return the org element representation of an element.
>
> Won't work on ~verb~/=code=-only headers"
>   (let ((prop-point (next-property-change 0 headline)))
> (if prop-point (plist-get (text-properties-at prop-point headline) :parent))))
>
> (defun rasmus/org-latex-clearpage (headline backend info)
>   "Insert a clearpage at end of heading if property clearpage is non-nil."
>   (when (org-export-derived-backend-p backend 'latex)
>     (let ((elm (rasmus/get-org-headline-string-element headline backend info)))
>       (when (and elm (org-element-property :CLEARPAGE elm))
> 	(concat headline "\\clearpage\\n")))))
>
> (add-to-list 'org-export-filter-headline-functions
>              'rasmus/org-latex-clearpage)
>
> Example file:
>
> * test
>   :PROPERTIES:
>   :clearpage: t
>   :END:
> ** sub1
> ** sub2

This looks very interesting for many things. Thanks.

Rainer

>
> —Rasmus

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

      reply	other threads:[~2015-01-21  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  9:59 End Section with \clearpage Rainer M Krug
2015-01-13 10:34 ` Rasmus
2015-01-21  9:25   ` Rainer M Krug [this message]

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=m2twzktri7.fsf@krugs.de \
    --to=rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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).