Quickhack for you

I sometimes need to export an org document into both HTML and LaTeX. In such case, I want HTML exporter to create numbered captions for figures and tables. So, I've written a small patch to add figure/table numbers to HTML captions.

ときどき HTML と LaTeX の両方にエクスポートしたくなりますよね. そんなとき,HTML の方にも図番号と表番号が付いて欲しいものです. そこで,パッチを書いみました.

Patch

I've submitted the patch to org-mode ML. I hope this patch becomes a part of org-mode.

せっかくなので org-mode ML にパッチを送りました.本家に取り込まれるといいなぁ. http://lists.gnu.org/archive/html/emacs-orgmode/2013-06/msg00958.html

取り込まれました (2013-06-29)

Example

#+TITLE: Add figure/table numbers to HTML captions
#+LATEX_CLASS: article
#+LANGUAGE: en
#+OPTIONS: toc:nil

* Figure Test
  See Figure[[fig:screenshot]] for screenshot.
  See Figure[[fig:manual]] for printed version of Org's manual.

  #+CAPTION: Org mode screen shot
  #+name: fig:screenshot
  [[http://orgmode.org/img/main.jpg]]

  This is org-mode logo: [[http://orgmode.org/img/org-mode-unicorn-logo.png]]
  (no caption, excluded from ordinal list).

  #+CAPTION: Org mode manual
  #+name: fig:manual
  [[http://orgmode.org/img/org-mode-7-network-theory.jpg]]

* Table Test
  Table[[tab:phone]] shows phone numbers.
  Table[[tab:age]] shows age list.

  #+caption: Phones
  #+name: tab:phone
  | Name  | Phone | Age |
  |-------+-------+-----|
  | Peter |  1234 |  17 |
  | Anna  |  4321 |  25 |

  This is a plain table (no caption, excluded from ordinal list):
  | No. | Letter |
  |-----+--------|
  |   1 | A      |
  |   2 | B      |

  #+caption: Ages
  #+name: tab:age
  | Name  | Age | Phone |
  |-------+-----+-------|
  | Peter |  17 |  1234 |
  | Anna  |  25 |  4321 |