emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}
@ 2013-06-29  1:08 feng shu
  2013-06-29 13:41 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: feng shu @ 2013-06-29  1:08 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1964 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-30  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-29  1:08 [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...} feng shu
2013-06-29 13:41 ` Rasmus
2013-06-29 23:32   ` Feng Shu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).