1

Is there a way in org-mode to have variable blocks of text. That is, to select between different bodies of inline text and examples, on the basis of a variable defined earlier.

I'm trying to create a tutorial for carrying out a task using two similar programs, using a single document and varying small parts of the explanation and the examples according to which program I want to export for.

I would have used \ifthenelse{}{}{} in LaTeX in the past, but I can't find a clean way to do this with org-mode.

1

I think you are looking for drawers. Here is an example org-file you can use to choose the PROG-A text or the PROG-B text on export. You just change the string in the options line, then export to the format you want.

#+options:  d:("PROG-A")

If you wrap conditional text in drawers you can specify which ones are exported.

:PROG-A:
Use this for program A
:END:

:PROG-B:
Use this for program B
:END:

:PROG-A:
Use other option for program A
:END:

:PROG-B:
Use this other option program B
:END:
1
  • Thank you, that works perfectly. And by manipulating the "d" option via the org-export-with-drawers variable, I can generate the two output files from the command line. – BrendanTH Feb 15 '20 at 19:50

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.