emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Captions Source Code
@ 2010-12-08 23:10 Andreas Leha
  2010-12-09 15:44 ` Captionshttp://adzes.tsdye2.com " Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Leha @ 2010-12-08 23:10 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 246 bytes --]

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


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Captionshttp://adzes.tsdye2.com Source Code
  2010-12-08 23:10 Captions Source Code Andreas Leha
@ 2010-12-09 15:44 ` Thomas S. Dye
  2010-12-09 17:39   ` Andreas Leha
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2010-12-09 15:44 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Captionshttp://adzes.tsdye2.com Source Code
  2010-12-09 15:44 ` Captionshttp://adzes.tsdye2.com " Thomas S. Dye
@ 2010-12-09 17:39   ` Andreas Leha
  2010-12-10  1:22     ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Leha @ 2010-12-09 17:39 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3008 bytes --]

Hi Tom,

thanks for the answer.  Works great.

The lstlistings LaTeX package, however, has the advantage of providing
captions without a float environment - it has its own caption= switch.

So I hoped, that I could do just
 #+source: identification-part
 #+begin_src latex :exports code
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesClass{org-article}[2010/11/25 0.3 (TSD)]
  #+end_src
and the Org-Export-Latex-Listings-W-Names option (maybe in connection
with a header argument) would also produce a caption in the latex  output.
But I could not find an option or header switch. So I guess it's just
not there...

Cheers,
Andreas







Am 09.12.2010 16:44, schrieb Thomas S. Dye:
> 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
>

-- 
Andreas Leha

Universitätsmedizin Göttingen
Abteilung Medizinische Statistik
Humboldtallee 32
37073 Göttingen

Tel: +49 (0)551 39-10710
Fax: +49 (0)551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha.html



University Medical Center Göttingen
Department for Medical Statistics
Humboldtallee 32
37073 Göttingen
Germany

Phone: +49 (0) 551 39-10710
Fax: +49 (0) 551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Captionshttp://adzes.tsdye2.com Source Code
  2010-12-09 17:39   ` Andreas Leha
@ 2010-12-10  1:22     ` Thomas S. Dye
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2010-12-10  1:22 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Aloha Andreas,

Good to hear it works for you.

I don't believe there is currently a way to use #+CAPTION: with  
anything other than links to images and with tables.

The approach with org-special-blocks has the advantage that it will  
work with the minted package as well as the listings package, in case  
you decide to switch packages mid-stream.

All the best,
Tom

On Dec 9, 2010, at 7:39 AM, Andreas Leha wrote:

> Hi Tom,
>
> thanks for the answer.  Works great.
>
> The lstlistings LaTeX package, however, has the advantage of providing
> captions without a float environment - it has its own caption= switch.
>
> So I hoped, that I could do just
> #+source: identification-part
> #+begin_src latex :exports code
>   \NeedsTeXFormat{LaTeX2e}
>   \ProvidesClass{org-article}[2010/11/25 0.3 (TSD)]
>  #+end_src
> and the Org-Export-Latex-Listings-W-Names option (maybe in connection
> with a header argument) would also produce a caption in the latex   
> output.
> But I could not find an option or header switch. So I guess it's just
> not there...
>
> Cheers,
> Andreas
>
>
>
>
>
>
>
> Am 09.12.2010 16:44, schrieb Thomas S. Dye:
>> 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
>>
>
> -- 
> Andreas Leha
>
> Universitätsmedizin Göttingen
> Abteilung Medizinische Statistik
> Humboldtallee 32
> 37073 Göttingen
>
> Tel: +49 (0)551 39-10710
> Fax: +49 (0)551 39-4995
>
> http://www.ams.med.uni-goettingen.de/amsneu/leha.html
>
>
>
> University Medical Center Göttingen
> Department for Medical Statistics
> Humboldtallee 32
> 37073 Göttingen
> Germany
>
> Phone: +49 (0) 551 39-10710
> Fax: +49 (0) 551 39-4995
>
> http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-10  1:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 23:10 Captions Source Code Andreas Leha
2010-12-09 15:44 ` Captionshttp://adzes.tsdye2.com " Thomas S. Dye
2010-12-09 17:39   ` Andreas Leha
2010-12-10  1:22     ` Thomas S. Dye

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).