This is a minimal working example of a workflow to use :exclude: tags with the ox-ipynb
exporter from org-mode to jupyter notebooks.
In this workflow, a single org-mode source file is used to generate both \LaTeX Beamer article style handouts and a Jupyter notebook.
The issue that I have run into is to include different content in the two output formats.
Most often I find that I want to include additional content in the \LaTeX Beamer article PDF file which should not be in the Jupyter notebook.
To do this, I follow the following workflow:
- Generate the org-mode source and add the tag
beamer
on each headline which I want to see only in the PDF version (generated through \LaTex Beamer). - Add the line
#+exclude_tag: beamer
to the top of the org-mode source file with all of the other org-mode options which are enabled/disabled for the file. See the top of this file as an example. - Export to the desired output format:
- When exporting to a Beamer PDF, simply remove the word
beamer
from the line#+exclude_tag: beamer
so that this line reads#+exclude_tag:
and export using the normal \LaTeX Beamer exporter. - When exporting to Jupyter notebooks using
ox-ipynb
, simply add the line#+exclude_tag: beamer
back into the org-mode source file and export usingox-ipynb
.
- When exporting to a Beamer PDF, simply remove the word
A problem may arise when trying to export to a Jupyter notebook through the ox-ipynb
package when this line is not present in the org-mode source file #+exclude_tag: beamer
but this line is #+exclude_tag:
.
To solve add the tag name beamer
back into this line and all should work.
The next headlines are part of the MWE highlighting this problem.
This should appear in both export formats (Beamer PDF and Jupyter notebook).
This too should appear in both export formats.
The line #+exclude_tag: beamer
should appear in org-mode source file if you are reading this from a PDF file or a Jupyter Notebook.
This contains additional redundant information which should not appear in the Jupyter Notebook export format.
If you are reading this in a PDF, you should see the line #+exclude_tag:
appear in the org-mode source file.