emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Adding #+LATEX: \newpage before section header using org-export-


From: Nick Dokos
Subject: Re: [O] Adding #+LATEX: \newpage before section header using org-export-before-parsing-hook
Date: Wed, 08 Feb 2017 20:27:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Joon Ro <address@hidden> writes:

> So far I have done:
>
> (defun org/parse-headings (backend)
>   (if (member backend '(latex))
>       (org-map-entries
>        (lambda ()
>          (progn
>            (insert-string "#+LATEX: \\newpage")
>            ))
>        "+newpage")
>     )
> )
>
> (add-hook 'org-export-before-parsing-hook 'org/parse-headings)
>
> This puts #+LATEX: \\newpage before the subheading, but the problem is if I 
> try to do (insert-string "#+LATEX: \\newpage"), exporting gets stuck with the 
> message "org-babel-exp process txt
> at position 280541...". I suspect inserting a string messes up the position. 
> How would I insert string with the newline character before a heading?
>
See the doc for org-map-entries - it says:

,----
| The call to FUNC will be wrapped into a save-excursion form, so FUNC
| does not need to preserve point.  After evaluation, the cursor will be
| moved to the end of the line (presumably of the headline of the
| processed entry) and search continues from there.  Under some
| circumstances, this may not produce the wanted results.  For example,
| if you have removed (e.g. archived) the current (sub)tree it could
| mean that the next entry will be skipped entirely.  In such cases, you
| can specify the position from where search should continue by making
| FUNC set the variable ‘org-map-continue-from’ to the desired buffer
| position.
`----

So you'll have to manipulate org-map-continue-from appropriately.

-- 
Nick




reply via email to

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