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.k...@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

_______________________________________________
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 via email to