emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Rainer M Krug <r.m.krug@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BABEL] syntax highlighting in LaTeX output?
Date: Fri, 09 Jul 2010 08:32:19 -0700	[thread overview]
Message-ID: <87wrt4hd6v.fsf@gmail.com> (raw)
In-Reply-To: AANLkTimqK6kj-JUmGuGeoNE3uBz6TNbNuDnR2PEHSTst@mail.gmail.com

Yes, set org-export-latex-listings to true.  Cheers -- Eric

,----[org-export-latex-listings]
| org-export-latex-listings is a variable defined in `org-latex.el'.
| Its value is nil
| 
| Documentation:
| Non-nil means export source code using the listings package.
| This package will fontify source code, possibly even with color.
| If you want to use this, you also need to make LaTeX use the
| listings package, and if you want to have color, the color
| package.  Just add these to `org-export-latex-packages-alist',
| for example using customize, or with something like
| 
|   (require 'org-latex)
|   (add-to-list 'org-export-latex-packages-alist '("" "listings"))
|   (add-to-list 'org-export-latex-packages-alist '("" "color"))
| 
| You can customize this variable.
`----

Rainer M Krug <r.m.krug@gmail.com> writes:

> Hi
>
> when I export to html, I get nice syntax highlighting in my source code (R),
> but when I export to pdf (via LaTeX), the source code is in normal verbatim,
> as it is in a verbatim environment.
>
> Is there any way to put it into a lstlisting environment, and probably even
> put the language from the source block in? In this way, one could get syntax
> highlighting in the pdf?
>
> An example:
>
> #+begin_src R  :exports code
>   x <- log(1:10)
> #+end_src
>
> is at the moment in the LaTeX output:
>
> \begin{verbatim}
> x <- log(1:10)
> \end{verbatim}
>
> Suggested output would be:\begin{lstlisting}[language=R]
> x <- log(1:10)
> \begin{lstlisting}
>
> Cheers,
>
> Rainer

      reply	other threads:[~2010-07-09 15:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09 11:00 [BABEL] syntax highlighting in LaTeX output? Rainer M Krug
2010-07-09 15:32 ` Eric Schulte [this message]

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=87wrt4hd6v.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=r.m.krug@gmail.com \
    /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).