I am using the emacs batch mode to script the export of
.org files to LaTeX via a
Makefile, and I am aware of some of the customization options that exist in that regard.
For example, I can (under Emacs 25.2.2 with org-mode 9.1.11) successfully use the command
emacs my.org --batch --eval "(org-latex-export-to-latex nil nil nil t)" --kill
to export only the body (via the fourth argument set to
my.org file to
my.tex. The arguments of
org-latex-export-to-latex are described at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3588.
I am now looking for a possibility to batch-export a specific subtree from an
.org file. In other words, while I have already managed to script the 'body-only'
C-e C-b option of a manual org-mode export, I am now trying to also automate its
C-e C-s option.
This raises the question of how to identify the desired subtree to-be-exported.
Not quite what I want: Export by
The exact same problem that I am describing is also formulated at
The responses suggest to export a section by its
ID property and include pointers to
for according emacs-lisp code, as well as a more specific emacs-lisp code example, which I can successfully get to export a specific section by its
However, this solution has the following flaws:
- It includes the heading of the section identified by
CUSTOM_ID, whereas a subtree exported manually via
C-e C-scontains only the content of the exported section (which is what I want).
- It requires me to specify
CUSTOM_IDs, whereas I am hoping to identify the subtree to-be-exported by the text of its headline.
- It requires emacs-lisp code. :)
Perhaps a better solution: 2nd argument of
The code for
org-latex-export-to-latex at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3575 shows that its second argument relates to the export of subtrees, and I am wondering whether it can be used to achieve my goals outlined above.
The comment at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3588 says:
When optional argument SUBTREEP is non-nil, export the sub-tree at point, extracting information from the headline properties first.
However, the code comment above to me raises the following questions:
- What does "at point" mean?
- How exactly would it "extract information from the headline properties"
- What meaningful non-nil values can I set this option to?
I would appreciate examples of how the second argument of
org-latex-export-to-latex can be used in practice.