From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Source blocks with captions Date: Mon, 23 Jun 2014 09:23:12 -1000 Message-ID: References: <8738evodqe.fsf@student.kit.edu> <87oaxj8wda.fsf@gmail.com> <87y4wnmpio.fsf@mailbox.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz9q6-0004sC-Ve for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 15:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz9q0-0003kl-53 for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 15:23:38 -0400 Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:55317) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Wz9pz-0003ii-Sx for emacs-orgmode@gnu.org; Mon, 23 Jun 2014 15:23:32 -0400 In-Reply-To: <87y4wnmpio.fsf@mailbox.org> (Alexander Baier's message of "Mon, 23 Jun 2014 20:47:43 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Aloha Alexander, Alexander Baier writes: > On 2014-06-23 17:43 Thorsten Jolitz wrote: >> Alexander Baier 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