(forgot to cc the list)
Begin forwarded message:
From: "Thomas S. Dye" <t...@tsdye.com>
Date: April 28, 2011 5:42:32 AM HST
To: Sébastien Vauban <wxhgmqzgw...@spammotel.com>
Subject: Re: [O] example or source blocks with captions
Aloha Seb,
On Apr 27, 2011, at 9:46 PM, Sébastien Vauban wrote:
Hi Thomas,
"Thomas S. Dye" wrote:
A while back I took a stab at an overly ambitious project that I've
subsequently dropped. In that project I did manage to establish
captions
that work with org-special-blocks. What follows is a cut and paste
job from
the bones of the project that might help you solve the problem of
captioning
constructs other than figures and tables. It was aimed primarily
at LaTeX
export, but I seem to recall that it worked for html as well.
All the best,
Tom
This link establishes a caption that works with both LaTeX and
html and can
be used to mark blocks that Org-mode doesn't recognize by default.
Note that
you currently have to enter these links by hand and not with the
usual
=org-insert-link= function, which doesn't allow spaces in the =PATH=
argument.
#+BEGIN_listing
# <<caption-link-type>>
#+source: define-caption-link
#+begin_src emacs-lisp :exports code
(org-add-link-type
"caption" nil
(lambda (path desc format)
(cond
((eq format 'html)
(format "<span class=\"caption\">%s</span>" desc))
((eq format 'latex)
(format "\\caption[%s]{%s}" path desc)))))
#+end_src
[[caption:A new caption link type][A new caption link type.]]
# <<fig:caption-link>>
#+END_listing
Block-level markup is accomplished with the help of the
[[latex:package][org-special-blocks]] package. It is used in this
file to
wrap the [[latex:progstruct][listing]] environment defined by the
[[latex:package][minted]] package around a source code block to
get a
floating listing in the LaTeX document.
Interesting read. Could you share the definition of your `latex'
link type?
Best regards,
Seb
--
Sébastien Vauban
Here it is,
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_3
All the best,
Tom