Hello, I would like to add a label to an image with only directive. I'm trying different combinations but I still get compilation errors.
Procedure to reproduce the problem
Here one example of what I'm trying to do.
Version A)
.. _img_label:
.. only:: html
.. figure:: imgname.png
:width: 800px
:align: center
:alt: This is the image caption
This is the image caption
.. only:: latex
.. figure:: imgname.png
:width: 400px
:align: center
:alt: This is the image caption
This is the image caption
Version B)
.. only:: html
.. _img_label:
.. figure:: imgname.png
:width: 800px
:align: center
:alt: This is the image caption
This is the image caption
.. only:: latex
.. _img_label:
.. figure:: imgname.png
:width: 400px
:align: center
:alt: This is the image caption
This is the image caption
The goal is to have an image which shall have different dimensions depending on the desired output format (html or pdf). This image shall posses an unique label in order to be correctly cited inside my document using the :numref:img_label command.
Subject: Labels for images with :only: directive
Problem
Hello, I would like to add a label to an image with only directive. I'm trying different combinations but I still get compilation errors.
Procedure to reproduce the problem
Here one example of what I'm trying to do.
Version A)
Version B)
Error logs / results
Error for Version A)
Error for Version B)
Expected results
The goal is to have an image which shall have different dimensions depending on the desired output format (html or pdf). This image shall posses an unique label in order to be correctly cited inside my document using the :numref:
img_label
command.Environment info