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

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to