emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Add figure/table numbers to HTML captions


From: Nicolas Goaziou
Subject: Re: [O] Add figure/table numbers to HTML captions
Date: Fri, 28 Jun 2013 11:23:41 +0200

Hello,

Yoshinari Nomura <address@hidden> writes:

> Thanks, you encouraged me. Also, while I made this patch, I was in
> the mood for consolidating some exporter-local functions around the
> captions. Especially, ox-odt and ox-ascii seem to have rich functions to
> add ordinal numbers to captions. It might be over-killing, though.

ox-odt caption handling is more complex because it handles more elements
(e.g., links to ODF files). ox-ascii provides the bare minimum wrt
caption numbering. This is what your patch provides.

> I'm afraid I made some misunderstand, but without this hunk,
> Tables/Figures without captions are mistakenly counted as a part of
> numbered staffs. As shown below, Figure[[fig:manual]] makes Figure3
> instead of Figure2.

Of course, you're right. I realized that just after sending the message.
Though, in the following snippet,

  (setq caption-predicate
        (if (org-element-property :caption destination)
         (lambda (elem &optional info)
           (org-element-property :caption elem))
          (lambda (elem &optional info)
           (not (org-element-property :caption elem)))))

I suggest to drop the "else" part. If destination hasn't got any
caption, numbering doesn't make much sense anyway. You can re-use
`org-html--has-caption-p'.
>
>>> -     ("es" :default "Figura"))
>>> +     ("es" :default "Figura")
>>> +     ("ja" :html "&#22259;" :utf-8 "図"))
>>> +    ("Figure %d:"
>>> +     ("de" :default "Abbildung %d:")
>>> +     ("es" :default "Figura %d:")
>>> +     ("ja" :html "&#22259;%d:" :utf-8 "図%d:"))
>> 
>> Maybe you should also provide a :default value, otherwise it will use
>> "Figure %d:" for latex, texinfo, ascii...
>
> Let me confirm, do you mean I should have add :default value to the ``ja''
> entry like: ("ja" :default "図" :html "&#22259;" :utf-8 "図")? In this
> case, is the `:utf-8' meaning-less? Also, can I put UTF-8 word in
> `:default'?

:utf-8 will be used for ODT export and UTF-8 export. LaTeX export will
try to use, in this order, :latex, :default and "Figure %d:". Plain
ASCII will use, in this order, :ascii, :default and "Figure %d:".

I suggest to use a simple entry for :default, maybe romanji, if it makes
sense. You can also use UTF-8 encoding as :default, and provide some
meaningful translation for :ascii.

> I'll revise my patch in this weekend. thanks.

Thank you.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]