On 2011-02-19, Antonio Valentino wrote:
> Hi Felix,
> Il giorno Tue, 15 Feb 2011 16:29:55 -0800 (PST)
> Felix Hummel <[email protected]> ha scritto:
>> Hi,
>> is there some "sphinxy" way for the Latex builder to get a figure's
>> name like "Figure 1.1" and not its caption?
>> If not: Is there *any* way?
If needed *only for LaTeX*, this can be easily done with a custom role
inheriting from raw.
The following works with Docutils. It might need adapted command
definitions for Sphinx.
Label and Reference via LaTeX and custom roles
===============================================
After defining two custom roles and their expansion in LaTeX, its possible
to utilise LaTeX's reference mechanism.
.. role:: ref
.. role:: label
.. raw:: latex
\newcommand*{\docutilsroleref}{\ref}
\newcommand*{\docutilsrolelabel}{\label}
.. figure:: mc.png
:width: 50
:label:`mc` Midnight Commander icon enlarged
Figure :ref:`mc` shows the icon for the file manager `Midnight
Commander` enlarged to a width of 50 Pixel.
This also works for section numbers, e.g. this is section
:ref:`label-and-reference-via-latex-and-custom-roles`.
The LaTeX output is OK, the HTML output can be improved with a custom
style sheet:
* Add the key ``Figure #:`` with ``:before`` pseudo class and automatic
numbering.
* Suppress the label with ``span.label{visibility: hidden;}``
* Replacing the reference with the correct number remains unsolved.
Günter
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.