emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.com>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Captionshttp://adzes.tsdye2.com Source Code
Date: Thu, 9 Dec 2010 05:44:41 -1000	[thread overview]
Message-ID: <FA37AD9A-8423-4CC4-9197-41923B6C6802@tsdye.com> (raw)
In-Reply-To: <4D00106F.2020500@med.uni-goettingen.de>

Aloha Andreas,

Here's one way to get captions with source code listings and a list of  
listings.

Use org-special-blocks to export a listing environment, e.g.

#+BEGIN_listing
#+source: identification-part
#+begin_src latex :exports code
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesClass{org-article}[2010/11/25 0.3 (TSD)]
#+end_src
#+LATEX: \caption[The identification part of the class file]{The  
identification part of the class file.}\label{fig:identification-part}
#+END_listing

The caption is in LaTeX here (which has the advantage of the optional  
argument).

You'll need to define a listing float type for LaTeX.  With the float  
package it might look like this:

\newfloat{listing}{h}{lol}
\newcommand\listingscaption{Listing}
\floatname{listing}{\listingscaption}
\newcommand\listoflistingscaption{List of Listings}
\providecommand\listoflistings{\listof{listing}{\listoflistingscaption}}
\floatplacement{listing}{htb!}

If you're using the KOMA scripts, which complain about the float  
package, something like this should work:

\DeclareNewTOC[type=listing,name=Listing,float,floatpos=htb!]{lol}
\newcommand\listoflistings{\listoftoc[List of Listings]{lol}}

hth,
Tom

On Dec 8, 2010, at 1:10 PM, Andreas Leha wrote:

> Hi all,
>
> has the feature of captions for source code blocks made any progress
> (see http://thread.gmane.org/gmane.emacs.orgmode/27896/focus=27913)?
>
> I am very interested in this feature for the latex listings package.
>
> Regards,
> Andreas
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-12-09 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 23:10 Captions Source Code Andreas Leha
2010-12-09 15:44 ` Thomas S. Dye [this message]
2010-12-09 17:39   ` Captionshttp://adzes.tsdye2.com " Andreas Leha
2010-12-10  1:22     ` Thomas S. Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FA37AD9A-8423-4CC4-9197-41923B6C6802@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).