emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: feng shu <tumashu@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}
Date: Sat, 29 Jun 2013 09:08:29 +0800	[thread overview]
Message-ID: <CAJpRBmdqNWwPAA+8m8=3CfmRWfQbSmJWjJvePm_1zpWNDvUiMA@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2013-06-29  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29  1:08 feng shu [this message]
2013-06-29 13:41 ` [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...} Rasmus
2013-06-29 23:32   ` Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJpRBmdqNWwPAA+8m8=3CfmRWfQbSmJWjJvePm_1zpWNDvUiMA@mail.gmail.com' \
    --to=tumashu@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).