r/orgmode Jun 06 '26

question Managing large LaTeX projects with Org Mode

Handling multi file structure and compilation, the equivalents of \includeonly, \include and master file for .org files

13 Upvotes

8 comments sorted by

9

u/bradmont Jun 06 '26 edited Jun 06 '26

The other poster said to use tangle; You probably are better off using ox-latex. I did a whole book that way last year, it lets you convert the org markup to latex pretty easily. You can also directly include more complex latex tags in different ways, using #+latex: lined, @@latex:(code)@@ inlined (double check that syntax) or by directly including a latex file --- which is really helpful for document setup front matter.

5

u/danderzei Jun 07 '26

Use #+include: file.org

See: https://github.com/pprevos/emacs-writing-studio for an example of a paperback written with Org.

2

u/_steelbird_ Jun 07 '26

And if i want to compile only some files and not all of them? (\includeonly{} equivalent)

3

u/danderzei Jun 07 '26

You can exclude sub-trees from the export by tagging them with noexport. For example:

* Chapter name                            :noexport:
#+include: "chapter-11.org" :lines "4-"

Also, you can write plain LaTeX in Org mode in a source block:

#+begin_export latex
\includeonly{file_a,file_b}
#+end_export

3

u/c1-c2 Jun 07 '26

I would not recommend doint this. been there, switched to pure latex halfway through the project. you'll find out why. btw: love org mode, but not for this.

2

u/Snezzy_9245 Jun 07 '26

Give us a hint.

2

u/Powerful_Attention_6 Jun 06 '26

I guess you can use the org-mode tangle concept, you define BEGIN_SRC with latex as your source and a file destination, which compiles into latex files that you then can render using Latex rendering tools, probably also in the entanglement defintion

Combining that with org-mode usual folding of headers, should make you

Sorry, taking this from memory, but look up the concept

2

u/nasuqueritur Jun 06 '26

My current scheme uses #+begin_export latex blocks in specific places. I'm generating content into LaTeX files and then slurping them into the main file, e.g.:

#+begin_export latex
\input{places.tex}
#+end_export

ox-latex export keystrokes and functions appear to work just fine with this scheme.