On Apr 4, 2024, at 11:11 AM, Richard Stanton <rhstanton@berkeley.edu> wrote:

I don't know if this does what you want, but I use a ‘PROPERTIES’ drawer right below the subtree's headline and in that drawer, I put the following code:

:EXPORT_LATEX_HEADER_EXTRA: \input{latex-preamble.tex}

Scott Randby

Thanks for the suggestion!

It would still be nice (i.e., you wouldn’t have to do this for every section you ever want to export) to have a way of specifying a line that gets executed for EVERY (say) LaTeX export. Or else an option to do something like include everything in the file before the first section header.

That capability does (if you’re careful) seem to exist. In my case, I just had to replace

#+include: setup.org

with 

#+setupfile: setup.org

and now exporting includes the macro definitions in setup.org even when I’m only exporting a subtree.