How can I have org #+INCLUDE: ignore configurations from the included files? I'm thinking of cases where I don't want Latex Classes to be messed up. For example, if I have two org files book.org and chapter.org that look like the following:


* Chapter 1
#+INCLUDE: chapter.org


#+LATEX_CLASS: report
* Results

Then on export (to another Org file) I get the following:

* Chapter 1
#+LATEX_CLASS: report
** Results

This is not good because a latex-export may get messed up (the last latex_class takes precedence, so I would end up with a report and not a book). What is the recommended way to avoid these issues?


Use the include directive's option: :only-contents t (https://orgmode.org/manual/Include-files.html), for example in book.org:

* Chapter 1    
** Results
#+INCLUDE: "chapter.org::*Results" 

Then only the contents below the header Results in chapter.org is included.

If you are specifying your latex class in an export property in chapter.org, like below

:EXPORT_LaTeX_CLASS: some class

then you can also include the whole org file

#+include: "chapter.org" :only-contents t
  • This does not work. All latex_headers, for example, are included with the file. – dangom Feb 26 '18 at 12:28
  • @dangom you're right, sorry edited my Answer. – Dieter.Wilhelm Feb 26 '18 at 15:01
  • This solution is not completely satisfactory, as I do not want to select a specific heading, but rather filter out some boilerplate without knowing in advance how much boilerplate it is. – dangom Feb 28 '18 at 1:10
  • @dangom: Then you should change your approach and specify your latex class in a property. – Dieter.Wilhelm Feb 28 '18 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.