# Include LaTeX code blocks from another file to generate a "main" file (similar to using \input{} in .tex)

I have a .org file (say exercises.org) in which I put LaTeX exercises in the form of code blocks. The file looks something like this:

#+NAME: ex1
#+BEGIN_EXPORT latex
Compute $2\cdot 2$.
#+END_EXPORT

#+NAME: ex2
#+BEGIN_EXPORT latex
Compute $2+2$.
#+END_EXPORT


I would like to have a second .org file (say course21.org) with references to the exercises.org file in order to generate a LaTeX document with a selection of exercises.

At the moment, I have tried the following content for course21.org:

#+INCLUDE: "./exercises.org"
#+BEGIN_EXPORT latex :noweb yes :tangle course.tex
As a first exercise: <<ex1>>
#+END_EXPORT


Obviously, the #+INCLUDE:... leads to the undesired behaviour of including all the blocks from the exercises.org file. However, even with that line, the first exercise does not show up (when calling M-x babel-tangle and the C-c C-e l p).

Moreover, this answer might be linked to my question but I did not manage to make it work.

My impression is this is related to referencing to code blocks from other files by name.

EDIT: deleted the latex after the END_SRC as mentioned in the comment (it was a typo).

• Tangel does not work on EXPORT blocks, it works on SRC blocks. Try changing EXPORT to SRC everywhere (and delete the latex after the last END_SRC): then tangle. Jun 21 at 13:47