From mboxrd@z Thu Jan 1 00:00:00 1970 From: org-mode@tsdye2.com (Thomas S. Dye) Subject: [PATCH] Optional \caption argument in LaTeX export Date: Sun, 08 May 2011 07:58:20 -1000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJ8FQ-0004TM-A8 for emacs-orgmode@gnu.org; Sun, 08 May 2011 13:58:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJ8FO-0000rg-NY for emacs-orgmode@gnu.org; Sun, 08 May 2011 13:58:28 -0400 Received: from oproxy1-pub.bluehost.com ([66.147.249.253]:34535) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QJ8FO-0000rI-Gv for emacs-orgmode@gnu.org; Sun, 08 May 2011 13:58:26 -0400 Received: from cpe-24-94-66-191.hawaii.res.rr.com ([24.94.66.191] helo=potofo-ou) by box472.bluehost.com with esmtpa (Exim 4.69) (envelope-from ) id 1QJ8FL-0000OL-CA for emacs-orgmode@gnu.org; Sun, 08 May 2011 11:58:23 -0600 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Aloha all, The attached patch initializes the shortn variable, uses it to add the optional argument to \caption in two places where this wasn't implemented, and adds a bit of documentation. Note that the shortn variable in org-mode is already used to add an optional argument to \caption in one case. The patch enables this behavior for other captions, as well. Note also, that if the shortn variable isn't initialized nil, the optional argument to one \caption is recycled to the next \caption indefinitely until shortn is reset. Thanks to Nick Dokos for explaining why an earlier patch of mine didn't show up on patchwork (wrong MIME type, evil mail client). This one is sent from gnus with crossed fingers. All the best, Tom --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-optional-caption-arguments-in-LaTeX-export.patch Content-Description: Optional caption argument in LaTeX export >From 9dc65f7e598dd171ebce9448cd39c4062f7cafff Mon Sep 17 00:00:00 2001 From: Tom Dye Date: Sun, 8 May 2011 06:56:25 -1000 Subject: [PATCH] optional caption arguments in LaTeX export --- doc/org.texi | 5 +++++ lisp/org-exp.el | 2 +- lisp/org-latex.el | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 844de6d..3988838 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -8817,6 +8817,11 @@ the object with @code{\ref@{tab:basic-data@}}: |-----|----| @end example +Optionally, the caption can take the form: +@example +#+CAPTION: [Caption for list of figures]{Caption for table (or link).} +@end example + @cindex inlined images, markup rules Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include images into the exported document. Org does this, if a link to an image diff --git a/lisp/org-exp.el b/lisp/org-exp.el index cda1f98..e840b6c 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1871,7 +1871,7 @@ table line. If it is a link, add it to the line containing the link." 'org-label label)) (if label (push (cons label label) target-alist)) (goto-char end) - (setq cap nil attr nil label nil))))) + (setq cap nil shortn nil attr nil label nil))))) target-alist) (defun org-export-remove-comment-blocks-and-subtrees () diff --git a/lisp/org-latex.el b/lisp/org-latex.el index bc9a3f3..516ee12 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2199,12 +2199,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (multicolumnp "\\begin{figure*}%placement \\centering \\includegraphics[%attr]{%path} -\\caption{%labelcmd%caption} +\\caption%shortn{%labelcmd%caption} \\end{figure*}") (floatp "\\begin{figure}%placement \\centering \\includegraphics[%attr]{%path} -\\caption{%labelcmd%caption} +\\caption%shortn{%labelcmd%caption} \\end{figure}") (t "\\includegraphics[%attr]{%path}"))) -- 1.7.1 --=-=-= -- http://www.tsdye.com --=-=-=--