[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] End Section with \clearpage
From: |
Rasmus |
Subject: |
Re: [O] End Section with \clearpage |
Date: |
Tue, 13 Jan 2015 11:34:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi,
Rainer M Krug <address@hidden> 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
—Rasmus
--
Summon the Mothership!