Here's an emacs defun to insert a numbered figure:

(defun rst-bk-numfigs (Fig)
  (interactive "sEnterh the name of the figure (e.g. markov-chain.png): ")
  (let (FigStripped FigStrippedLowerCase)
    (setq FigStripped (replace-regexp-in-string "[^a-zA-Z]" "" Fig))

    (with-temp-buffer
      (insert FigStripped)
      (downcase-region (point-min) (point-max))
      (setq FigStrippedLowerCase (buffer-substring-no-properties 
(point-min) (point-max))))

    (insert (format "\
:num:`Fig. #%s`).

.. _%s:

.. figure:: _static/%s
   :width: 50%s
   :alt: %s
   :align: center

.. don't forget to enter caption:
   
" FigStrippedLowerCase FigStrippedLowerCase Fig "%" Fig)))
  (search-backward-regexp "`).") 
  (forward-char 3)
  (insert " "))

On Thursday, August 30, 2012 11:29:20 PM UTC+4, kt-fsi wrote:
>
> Is it somehow possible to have a figure caption different form the text of 
> the link to that figure?
>
> This may also help. It is a sphinx extension. We use this to have 'Figure 
> #' display in our HTML output: (numfig extension with the role, :num: )
>
> https://bitbucket.org/arjones6/sphinx-numfig/wiki/Home
>
> Kathy
> ka...@tolbert.org <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/Iuyh7g3QQ-kJ.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to