[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Source blocks with captions
From: |
Alexander Baier |
Subject: |
Re: [O] Source blocks with captions |
Date: |
Tue, 24 Jun 2014 14:31:43 +0200 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) |
On 2014-06-23 21:23 Thomas S. Dye wrote:
> Aloha Alexander,
>
> Alexander Baier <address@hidden> writes:
>
>> On 2014-06-23 17:43 Thorsten Jolitz wrote:
>>> Alexander Baier <address@hidden> writes:
>>>
>>>> Hello org-moders!
>>>>
>>>> I just tried to put a caption under/on/above (or anywhere for that
>>>> matter) my source code block. When exporting to latex, I didn't see any
>>>> caption belonging to my code block. Other backends have not been
>>>> tried. How can I achieve this?
>>>>
>>>> For reference, I run Org-mode version 8.2.6 (release_8.2.6 @
>>>> /home/delexi/.emacs.d/ext/org-mode/lisp/) and this is the org file:
>>>>
>>>> * Test
>>>> #+CAPTION: Test
>>>> #BEGIN_SRC java
>>>> // some code
>>>> #END_SRC
>>>
>>> shouldn't that be
>>>
>>> ,----
>>> | #+NAME: Test
>>> `----
>>>
>>> instead of
>>>
>>> ,----
>>> | #+CAPTION: Test
>>> `----
>>>
>>> ?
>>
>> This does not work for me - I still see no caption or a similar thing in
>> the vicinity of my code block. Does "#+NAME" work for you?
>>
>> Regards,
>
> There are two errors in your Org mode file on the BEGIN_SRC and END_SRC
> lines.
You are of course right! This was just a mistake I made whilst putting
together this short example. In my "normal" setup the source code
blocks have the right form.
> With this code:
>
> * Test
>
> #+CAPTION: Test
> #+BEGIN_SRC java
> // some code
> #+END_SRC
>
> I get a figure with a caption when exporting to LaTeX:
>
> \section{Test}
> \label{sec-1}
>
> \begin{figure}[H]
> \begin{verbatim}
> // some code
> \end{verbatim}\caption{Test}
>
> \end{figure}
>
> You don't need to name the source code block, although it is typically a
> good idea to do so.
I always only looked at the generated PDF to see if there was a caption
added. When opening the generated .tex file I found the same code you
are seeing. It seems the document class I am using just drops the
caption.
The class in question is LLNCS, does anyone know why this could happen?
Regards,
--
Alexander Baier