0

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).

1
  • 1
    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.
    – NickD
    Jun 21 at 13:47

Your Answer

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

Browse other questions tagged or ask your own question.