emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property


From: feng shu
Subject: Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property
Date: Tue, 2 Jul 2013 07:58:41 +0800

Thanks all the people! This is V5!


On Tue, Jul 2, 2013 at 5:38 AM, Nicolas Goaziou <address@hidden> wrote:
Hello,

feng shu <address@hidden> writes:

> Thanks for your help. This is V4 patch.

Thanks for the update. More comments below.

> address@hidden :caption
> +By default, you should use @code{#+caption} keyword to add a table caption.
> +If you want to add caption with complex or special latex commands, you can use
> address@hidden:caption} attribute. It will precedence over @code{#+caption} keyword.
> +It should be set with raw latex command and nothing in it will be
> +interpreted by Org.

You need to use upper cases for keywords: @code{#+CAPTION}. Also,
sentences are expected to end with two spaces and latex should be typed
@LaTeX{}. Here is a suggestion (note that I'm not a wording expert):


 
  @code{#+CAPTION} keyword is the simplest way to set a caption for
  a table (@pxref{Images and tables}).  If you need more advanced commands
  for that task, you can use @code{:caption} attribute instead. Its value
  should be raw @LaTeX{} code.  It has precedence over @code{#+CAPTION}.

I think it's much good than mine. For me, writing documentation is a painful thing.
 
> +When export the below example to latex, the table caption will be set
> +with latex command @address@hidden address@hidden@{Heading address@hidden instead of
> address@hidden keywords.

  In the example below, @LaTeX{} command @address@hidden
  address@hidden@{Heading address@hidden will set the caption. (I think you can drop the rest
  of the sentence).

> address@hidden:width} and @code{:height} attributes.  It is also possible to add any
> -other option with the @code{:options} attribute, as shown in the following
> -example:
> address@hidden:width} and @code{:height} attributes. If you want to set image
> +caption with special latex command, you can use @code{:caption} attribute,
> +for example:

Besides the missing two spaces at the end of the sentence, I suggest the
following:

  You can specify specify image width or height with, respectively,
  @code{:width} and @code{:height} attributes.  It is also possible to add any
  other option with the @code{:options} attribute, as shown in the following
  example:

  EXAMPLE

  If you need a specific command for the caption, use @code{:caption}
  attribute.  It will override standard @code{#+CAPTION} value, if any.

  EXAMPLE?

Also, you don't seem to document the feature for special blocks.

> -      (short (org-export-get-caption element t)))
> -    (cond
> -     ((and (not main) (equal label-str "")) "")
> -     ((not main) (concat label-str "\n"))
> -     ;; Option caption format with short name.
> -     (short (format "\\caption[%s]{%s%s}\n"
> -                 (org-export-data short info)
> -                 label-str
> -                 (org-export-data main info)))
> -     ;; Standard caption format.
> -     (t (format "\\caption{%s%s}\n" label-str (org-export-data main info))))))
> +      (short (org-export-get-caption element t))
> +      (caption-from-attr-latex (org-export-read-attribute :attr_latex element :caption)))
> +    (cond ((org-string-nw-p caption-from-attr-latex)
> +        (concat caption-from-attr-latex "\n"))
> +       ((and (not main) (equal label-str "")))

Why do you drop the return value (empty string) here?

It's my mistake!

Regards,

--
Nicolas Goaziou

Attachment: 0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


reply via email to

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