[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Source blocks with captions
From: |
Thomas S. Dye |
Subject: |
Re: [O] Source blocks with captions |
Date: |
Mon, 23 Jun 2014 09:23:12 -1000 |
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.
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.
hth,
Tom
--
Thomas S. Dye
http://www.tsdye.com