In org-mode, what are the options if I want to have different latex headers for each different subtree? I want different subtrees to export to .tex files with different headers; and I want org-toggle-latex-fragment to use a different header depending on the subtree.

For instance, I can have

#+latex_header: \newcommand\nat{\mathbb{N}}

at the top of the file and it will affect all subtrees of the org file. Is there any way to have this declaration work on only a single specific subtree? A similar situation is that of the 'title' attribute; we can have a main title #+Title at the beginning of the document, but we can also have specific titles for each subtree with the property :EXPORT_TITLE:. Is there any :EXPORT_LATEX_HEADER: that would work analogously for #+latex_header?

  • 1
    I'm not sure I understand your question, but when org parses a document #+LATEX_HEADER is indeed added to the preamble of the resulting .tex file. To use latex code at right where you put it (and thus in the 'document' part of the .tex file), you can use #+LATEX:. To alter your \nat command in the middle of a text, you could use #+LATEX: \renewcommand or something like that. – EFLS Nov 21 at 18:37
  • Thank you. I usually export subtrees separately, so would like it to be included in the preamble of the resulting .tex of only one subtree, without affecting the others. Having a \renewcommand on the middle of the document would work, but then I should figure out how each header reordering affects the structure (I guess?) and it would not work with latex preview. If I do not find anything better, I will use this. Thanks again! I have also tried to clarify the question – Mario Román Nov 21 at 18:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.