emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Syntax highlighting of code blocks in beamer slides
@ 2012-03-13 13:41 Stefan Vollmar
  2012-03-13 13:44 ` Alan Schmitt
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Vollmar @ 2012-03-13 13:41 UTC (permalink / raw)
  To: emacs-orgmode Mode

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

Hello,

we want to create slides via beamer. This works fine except for source code listings (#begin_src python...#end_src) - if exported as HTML they have syntax-highlighting as expected, however, when exported as LaTeX the syntax-highlighting is lost. Is there a way to create beamer slides with source code snippets that have syntax-highlighting?

Many thanks in advance!

Warm regards, 
 Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de   http://www.nf.mpg.de









[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]

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

* Re: Syntax highlighting of code blocks in beamer slides
  2012-03-13 13:41 Syntax highlighting of code blocks in beamer slides Stefan Vollmar
@ 2012-03-13 13:44 ` Alan Schmitt
  2012-03-13 13:58   ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Schmitt @ 2012-03-13 13:44 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode Mode

On 13 mars 2012, at 14:41, Stefan Vollmar wrote:

> Hello,
> 
> we want to create slides via beamer. This works fine except for source code listings (#begin_src python...#end_src) - if exported as HTML they have syntax-highlighting as expected, however, when exported as LaTeX the syntax-highlighting is lost. Is there a way to create beamer slides with source code snippets that have syntax-highlighting?

I'm following this tutorial for this:
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-3

Alan

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

* Re: Syntax highlighting of code blocks in beamer slides
  2012-03-13 13:44 ` Alan Schmitt
@ 2012-03-13 13:58   ` Nick Dokos
  2012-03-14 12:12     ` Stefan Vollmar
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-03-13 13:58 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: nicholas.dokos, emacs-orgmode Mode

Alan Schmitt <alan.schmitt@polytechnique.org> wrote:

> On 13 mars 2012, at 14:41, Stefan Vollmar wrote:
> 
> > Hello, we want to create slides via beamer. This works fine except
> > for source code listings (#begin_src python...#end_src) - if
> > exported as HTML they have syntax-highlighting as expected, however,
> > when exported as LaTeX the syntax-highlighting is lost. Is there a
> > way to create beamer slides with source code snippets that have
> > syntax-highlighting?
> 
> I'm following this tutorial for this:
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-3
> 

Yup, I followed the tutorial and set up minted some time ago and I have
not looked back: I just tried the following

--8<---------------cut here---------------start------------->8---
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]
#+BEAMER_FRAME_LEVEL: 1
#+BEAMER_HEADER_EXTRA: \usetheme{default}\usecolortheme{default}
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC


* foo

#+BEGIN_SRC python :exports code
  for x in range(100):
      print "x=%d , x^2=%d" % (x, x*x)
#+END_SRC
--8<---------------cut here---------------end--------------->8---


and I get a caleidoscope of colors.

The TeX FAQ has some details about where to get minted and its dependencies
(it requires an external Python script, called Pygments):

     http://www.tex.ac.uk/cgi-bin/texfaq2html?label=codelist

Nick

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

* Re: Syntax highlighting of code blocks in beamer slides
  2012-03-13 13:58   ` Nick Dokos
@ 2012-03-14 12:12     ` Stefan Vollmar
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Vollmar @ 2012-03-14 12:12 UTC (permalink / raw)
  To: Nick Dokos, Alan Schmitt; +Cc: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]

Dear Alan,
dear Nick,

many thanks for your help. Installing minted and pygments and then putting the emacs-lisp snippet from

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-3

into my .emacs file did work. Now my code snippets are syntax-highlighted! Do you have any suggestions on which pygments color styles work well in presentations?

Many thanks in advance,
 Stefan 

On 13.03.2012, at 14:58, Nick Dokos wrote:

> Alan Schmitt <alan.schmitt@polytechnique.org> wrote:
> 
>> On 13 mars 2012, at 14:41, Stefan Vollmar wrote:
>> 
>>> Hello, we want to create slides via beamer. This works fine except
>>> for source code listings (#begin_src python...#end_src) - if
>>> exported as HTML they have syntax-highlighting as expected, however,
>>> when exported as LaTeX the syntax-highlighting is lost. Is there a
>>> way to create beamer slides with source code snippets that have
>>> syntax-highlighting?
>> 
>> I'm following this tutorial for this:
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-3
>> 
> 
> Yup, I followed the tutorial and set up minted some time ago and I have
> not looked back: I just tried the following
> 
> --8<---------------cut here---------------start------------->8---
> #+LaTeX_CLASS: beamer
> #+LaTeX_CLASS_OPTIONS: [presentation]
> #+BEAMER_FRAME_LEVEL: 1
> #+BEAMER_HEADER_EXTRA: \usetheme{default}\usecolortheme{default}
> #+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
> #+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
> 
> 
> * foo
> 
> #+BEGIN_SRC python :exports code
>  for x in range(100):
>      print "x=%d , x^2=%d" % (x, x*x)
> #+END_SRC
> --8<---------------cut here---------------end--------------->8---
> 
> 
> and I get a caleidoscope of colors.
> 
> The TeX FAQ has some details about where to get minted and its dependencies
> (it requires an external Python script, called Pygments):
> 
>     http://www.tex.ac.uk/cgi-bin/texfaq2html?label=codelist
> 
> Nick

-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de







[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]

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

end of thread, other threads:[~2012-03-14 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 13:41 Syntax highlighting of code blocks in beamer slides Stefan Vollmar
2012-03-13 13:44 ` Alan Schmitt
2012-03-13 13:58   ` Nick Dokos
2012-03-14 12:12     ` Stefan Vollmar

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