Hi Mario, You can use `dot.*` as a filename. refs: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#images ``` Dear reader, behold :numref:`Fig %s <fooBar>`.
.. _fooBar: .. figure:: docgraphs/dot/dot.* :figwidth: 80 % :width: 80 % :align: center ``` This provides `dot.svg` for html and `dot.png` for latex. Please refer supported_image_types attribute in the bellow page. You can get the supported image format for each builders. http://www.sphinx-doc.org/en/master/builders.html Regards, On Fri, Mar 9, 2018 at 12:24 AM Mario S. Mommer <[email protected]> wrote: > 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. > -- 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.
