emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Bernt Hansen <bernt@norang.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Optional \caption argument for LaTeX export
Date: Sun, 08 May 2011 16:49:35 -1000	[thread overview]
Message-ID: <m17ha0r3k0.fsf@tsdye.com> (raw)
In-Reply-To: <87wri0d354.fsf@norang.ca> (Bernt Hansen's message of "Sun, 08 May 2011 22:22:15 -0400")

Bernt Hansen <bernt@norang.ca> writes:

> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Bernt Hansen <bernt@norang.ca> writes:
>>
>>> tsd@tsdye.com (Thomas S. Dye) writes:
>>>
>>>> With this patch, #+CAPTION: [Short caption]{Long caption.} in the
>>>> Org-mode source exports to \caption[Short caption]{Long caption.} in the
>>>> LaTeX export, which is, I think, as it should be.
>>>
>>> Hi Thomas,
>>>
>>> Thanks for the patch!
>>>
>>> Please add the above details (without the 'With this patch' and ', which
>>> is, I think, as it should be') to body of the commit message (starting
>>> on line 3).  This makes it possible to read just the commit log message
>>> 6 months from now and know what the patch is about without the necessity
>>> of reading the code changes.
>>>
>>> Regards,
>>> Bernt
>>>
>>
>> 6 months ... yikes!
>>
>> I think this is what you're asking for.  Let me know if it falls short.
>
> Close :)
>
> The attached patch would be better I think.  After applying it 
> git log shows the following:
>
> ,----
> | ~/git/org-mode$ git log -1
> | commit cec944435abb688dd1e4b5acbe6d9bcc557c171b
> | Author: Tom Dye <tsd@tsdye.com>
> | Date:   Sun May 8 13:16:15 2011 -1000
> | 
> |     Activate optional argument to LaTeX caption command
> |     
> |     * doc/org.texi (Images and tables): Document optional #+CAPTION: form
> |     * lisp/org-exp.el: Add support for optional caption form
> |     * lisp/org-latex.el: Add support for optional caption form
> |     
> |     Captions of the form
> |        #+CAPTION: [Short caption]{Long caption.}
> |     export to
> |        \caption[Short caption]{Long caption.} in the LaTeX export.
> `----
>
> git needs the blank line separating the subject from the body and I've
> added the changelog entries (although you might want to reword them if
> they are incorrect.
>
> The updated patch is attached.
>
> Regards,
> Bernt
>
>
> From 37eba27e80a84175e09b01e7125269154c40396d Mon Sep 17 00:00:00 2001
> From: Tom Dye <tsd@tsdye.com>
> Date: Sun, 8 May 2011 13:16:15 -1000
> Subject: [PATCH] Activate optional argument to LaTeX caption command
>
> * doc/org.texi (Images and tables): Document optional #+CAPTION: form
> * lisp/org-exp.el: Add support for optional caption form
> * lisp/org-latex.el: Add support for optional caption form
>
> Captions of the form
>    #+CAPTION: [Short caption]{Long caption.}
> export to
>    \caption[Short caption]{Long caption.} in the LaTeX export.
> ---
>  doc/org.texi      |    6 ++++++
>  lisp/org-exp.el   |    2 +-
>  lisp/org-latex.el |    4 ++--
>  3 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index 844de6d..8058288 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -8817,6 +8817,12 @@ 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}")))

Thanks Bernt,

Anything left for me to do?

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

  reply	other threads:[~2011-05-09  2:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08 20:11 [PATCH] Optional \caption argument for LaTeX export Thomas S. Dye
2011-05-08 20:16 ` [Accepted] " Carsten Dominik
2011-05-08 21:32 ` [PATCH] " Bernt Hansen
2011-05-08 23:22   ` Thomas S. Dye
2011-05-09  2:22     ` Bernt Hansen
2011-05-09  2:49       ` Thomas S. Dye [this message]
2011-05-09  2:52         ` Bernt Hansen

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=m17ha0r3k0.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=bernt@norang.ca \
    --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).