Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Guenter Milde <milde <at> users.berlios.de>
Subject: Re: Cross referencing figures?
Newsgroups: gmane.text.docutils.user
Date: Wednesday 24th February 2010 13:21:11 UTC (over 7 years ago)
On 2010-02-23, Berthold Hoellmann wrote:
> Is there any target for figures that expands to the figure number::

>   see `figure ???`_

>   .. figure:: xx.png

>      this is a test

> Rendered as "see figure 1", followd by the image?

As there are no figure numbers in HTML, this is not possible
independent of output format.

But not all is lost, see below.

G√ľnter



How to label and reference a "formal" figure with RST
*****************************************************

And now for something completely different.

Handcrafted Figure numbering for HTML
=====================================

.. _mcicon:

.. figure:: mc.png
   
   Figure 1: Midnight Commander icon
   
`Figure 1`_ shows an icon for the file manager `Midnight Commander`.

The HTML output is OK, in the LaTeX->PDF output, the key ``Figure 1:`` is
repeated.


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.

The LaTeX output is OK, the HTML output can be corrected 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.

.. List of figures

.. _Figure 1: mcicon_




------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
 
CD: 4ms