[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Exporting source code blocks as LaTeX figures
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Exporting source code blocks as LaTeX figures |
Date: |
Sat, 18 May 2013 09:39:49 +0200 |
Hello,
James Harkins <address@hidden> writes:
> Couple of questions about exporting LaTeX figures that are neither
> tables nor images -- specifically, source code blocks using the
> listings package.
>
> 1. Is there any way to use #+CAPTION with a #+BEGIN_figure block, so
> that the caption will be rendered underneath the text in the figure?
>
> It seems (from reading the org manual and some experimentation on my
> own) that the answer is no. That's rather inconvenient; the journal
> specifies that captions should appear below their respective figures,
> but as it is:
>
> #+CAPTION: Some code
> #+NAME: code1
> #+BEGIN_figure
> #+BEGIN_SRC {}
> // blah blah
Why don't you use:
#+begin_figure
#+caption: Some code
#+name: code1
#+begin_src {}
// blah blah
instead? I.e., why don't you apply caption to src block? You can tweak
the position of the caption with "captionpos" option in listings
environment.
Caption are not supported in special blocks because these could contain
more than one object, and it wouldn't be clear which of them would have
the caption.
> 2. Is the customize variable "Org Latex Default Figure Position" only
> used for tables and images? It would be nice if it applied to
> BEGIN_figure as well (unless :options override that). "#+ATTR_LaTeX:
> :options [htb]" is a mite inconvenient to replicate for every code
> example. Certainly possible, but it would save a little effort if the
> default were used here too.
BEGIN_figure is a "special block", i.e. a generic environment. "[htb]"
does not always make sense in every environment.
Also, figure environment is created automatically in some cases (e.g.,
when `org-latex-listings' is nil and source block is captioned), so you
generally don't need to write it explicitly.
Anyway, you can easily add "[htb]" options to all figure environments in
the output with a filter.
Regards,
--
Nicolas Goaziou