emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [need help] How to add a caption to table with #+attr_latex :caption


From: feng shu
Subject: [O] [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}
Date: Sat, 29 Jun 2013 09:08:29 +0800

HI:

In my thesie, I need add a caption to table or figure with \bicaption{中文标题}{English title}

I can't find the easy way to do this in org-mode ,so  I add :caption  to #+attr_latex:
 
for example:

#+attr_latex:  :caption \bicaption{...}{....}


But the below function doesn't work as expected, someone can help me?  thanks!

#+begin_src emacs-lisp
(defun org-latex--caption/label-string (element info)
  "Return caption and label LaTeX string for ELEMENT.

INFO is a plist holding contextual information.  If there's no
caption nor label, return the empty string.

For non-floats, see `org-latex--wrap-label'."
  (let* ((label (org-element-property :name element))
     (label-str (if (not (org-string-nw-p label)) ""
              (format "\\label{%s}"
                  (org-export-solidify-link-text label))))
     (main (org-export-get-caption element))
     (short (org-export-get-caption element t))
     (caption-from-latex-attr (plist-get (org-export-read-attribute :attr_latex element) :caption)))
    (cond
     ((and (not main) (equal label-str "")) (format "%s" caption-from-latex-attr))
     ((not main) (concat label-str "\n" (format "%s" caption-from-latex-attr)))
     ;; 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))))))

#+end_src

reply via email to

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