3

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

Community
  • 1
  • 1
lofidevops
  • 15,528
  • 14
  • 79
  • 119

1 Answers1

6

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"
mzjn
  • 48,958
  • 13
  • 128
  • 248