Question

I am generating a PDF via Sphinx using the autogenerated Makefile. I usually generate it using:

make latexpdf

However, I am now including the only directive, so that some sections appear conditionally (this should happen if I include the relevant tag at the command line).

I added the following reST markup to my source file:

Hello world

.. only:: draft

          This is some draft content.

I tried generating the PDF as follows:

SPHINXOPTS="-t draft" make latexpdf

...but the output is the same as if I'd just run make latexpdf as normal, the "only" section does not appear. Is there a problem in my reST or my command line invocation?

(Also, I'd like to specify multiple tags if possible, e.g. draft and admin.)

Was it helpful?

Solution

You need to modify the command a little (the variable assignment must come after make). Either of these work for me (using GNU make):

make SPHINXOPTS="-t draft" latexpdf    

or

make latexpdf SPHINXOPTS="-t draft"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top