From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Baier Subject: Re: Source blocks with captions Date: Tue, 24 Jun 2014 14:31:43 +0200 Message-ID: <87pphymqts.fsf@mailbox.org> 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]:51571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzPtJ-0001Xn-Nt for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 08:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzPtD-0004xc-Dq for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 08:32:01 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:57938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzPtC-0004xR-VW for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 08:31:55 -0400 In-Reply-To: (Thomas S. Dye's message of "Mon, 23 Jun 2014 09:23:12 -1000") 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: "Thomas S. Dye" Cc: emacs-orgmode@gnu.org, Thorsten Jolitz On 2014-06-23 21:23 Thomas S. Dye wrote: > 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. 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