emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] example or source blocks with captions


From: Sébastien Vauban
Subject: Re: [O] example or source blocks with captions
Date: Thu, 28 Apr 2011 09:46:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]