Mario S. Mommer
unread,Mar 8, 2018, 10:24:32 AM3/8/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sphinx...@googlegroups.com
Hello,
with Sphinx v1.5.5, I want to reference a figure by number. At the same
time, I want to have different image formats for html or for latex.
While I can get each feature to work, I haven't been successful at
getting the combination to work.
The following works, of course:
=============
Dear reader, behold :numref:`Fig %s <fooBar>`.
.. _fooBar:
.. figure:: docgraphs/dot/dot.png
:figwidth: 80 %
:width: 80 %
:align: center
=============
With conditionals it looks like follows (and does not work)
=============
Dear reader, behold :numref:`Fig %s <fooBar>`.
.. _fooBar:
.. only:: latex
.. figure:: docgraphs/dot/dot.png
:figwidth: 80 %
:width: 80 %
:align: center
.. only:: html
.. figure:: docgraphs/dot/dot.svg
:figwidth: 80 %
:width: 100 %
:align: center
================
It says "WARNING: undefined label:foobar"
An alternative does not work, either:
=============
Dear reader, behold :numref:`Fig %s <fooBar>`.
.. only:: latex
.. _fooBar:
.. figure:: docgraphs/dot/dot.png
:figwidth: 80 %
:width: 80 %
:align: center
.. only:: html
.. _fooBar:
.. figure:: docgraphs/dot/dot.svg
:figwidth: 80 %
:width: 100 %
:align: center
================
Here it says fist
WARNING: Duplicate explicit target name: foobar
and then
WARNING: undefined label: foobar
How can I place the labels correctly? Any ideas / advice?
Regards, and thanks,
Mario