* Re: listings and the new LaTeX exporter
2012-05-24 20:13 ` Jambunathan K
@ 2012-05-24 20:58 ` Andreas Leha
2012-05-24 21:09 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Leha @ 2012-05-24 20:58 UTC (permalink / raw)
To: emacs-orgmode
Hi Jambunathan,
> M-x customize-group RET org-export-e-latex RET
>
> (Hint: Search for listing)
Thanks for looking into this. This variable is set to "t".
Sorry, that I did not give a more complete workflow of how I do *not* get
listings with the new LaTeX exporter.
This now follows.
Here is the .emacs.org
,----
| (add-to-list 'load-path (expand-file-name "~/local/emacs/org-mode-install/lisp"))
| (add-to-list 'auto-mode-alist '("\\.\\(org\\ |org_archive\\|txt\\)$" . org-mode))
| (require 'org-install)
| (require 'org-habit)
|
| (add-to-list 'load-path (expand-file-name "~/local/emacs/org-mode/contrib/lisp"))
| (require 'org-export)
|
| (global-set-key "\C-cl" 'org-store-link)
| (global-set-key "\C-ca" 'org-agenda)
| (global-set-key "\C-cb" 'org-iswitchb)
`----
I do emacs -Q -l .emacs.org, set the 'org-export-latex-listings to t and
run the org-export-dispatch "L" on this file:
,----
| #+TITLE: Test the listings
|
|
| * Some listing
| #+begin_src R
| bh <- basehaz(coxmodel.cont.64)
| #+end_src
|
| * Options :noexport:
| #+LaTeX_CLASS_OPTIONS: [11pt]
| #+LATEX_HEADER: \setlength{\parindent}{0pt}
| #+LATEX_HEADER: \setlength{\parskip}{1ex}
| #+LATEX_HEADER: \usepackage{listings}
| #+LATEX_HEADER: \usepackage{color}
| #+LATEX_HEADER: \definecolor{mylstback}{RGB}{200,200,200} % light gray
| #+LATEX_HEADER: \lstloadlanguages{R}
| #+LATEX_HEADER: \lstdefinelanguage{Renhanced}[]{R}{%
| #+LATEX_HEADER: morekeywords={acf,ar,arima,arima.sim,colMeans,colSums,is.na,is.null,%
| #+LATEX_HEADER: mapply,ms,na.rm,nlmin,replicate,row.names,rowMeans,rowSums,seasonal,%
| #+LATEX_HEADER: sys.time,system.time,ts.plot,which.max,which.min},
| #+LATEX_HEADER: deletekeywords={c},%
| #+LATEX_HEADER: alsoletter={._\%},%
| #+LATEX_HEADER: alsoother={:\$}}
| #+LATEX_HEADER: \lstset{%
| #+LATEX_HEADER: extendedchars=true,%
| #+LATEX_HEADER: basicstyle=\ttfamily\scriptsize, % the font that is used for the code
| #+LATEX_HEADER: tabsize=4, % sets default tabsize to 4 spaces
| #+LATEX_HEADER: numbers=left, % where to put the line numbers
| #+LATEX_HEADER: numberstyle=\tiny, % line number font size
| #+LATEX_HEADER: stepnumber=4, % step between two line numbers
| #+LATEX_HEADER: breaklines=false, %!! don't break long lines of code
| #+LATEX_HEADER: showtabs=false, % show tabs within strings adding particular underscores
| #+LATEX_HEADER: showspaces=false, % show spaces adding particular underscores
| #+LATEX_HEADER: showstringspaces=false, % underline spaces within strings
| #+LATEX_HEADER: frame=tb,%
| #+LATEX_HEADER: keywordstyle=\color{blue},
| #+LATEX_HEADER: identifierstyle=\color{black},
| #+LATEX_HEADER: stringstyle=\color{green},
| #+LATEX_HEADER: commentstyle={\color{red}\ttfamily\itshape},
| #+LATEX_HEADER: backgroundcolor=\color{mylstback}, % sets the background color
| #+LATEX_HEADER: captionpos=t, % sets the caption position to `bottom'
| #+LATEX_HEADER: extendedchars=false %!?? workaround for when the listed file is in UTF-8
| #+LATEX_HEADER: }
`----
The result is this:
,----
| % Created 2012-05-24 Do 22:52
| \documentclass[11pt]{article}
| \usepackage[utf8]{inputenc}
| \usepackage[T1]{fontenc}
| \usepackage{fixltx2e}
| \usepackage{graphicx}
| \usepackage{longtable}
| \usepackage{float}
| \usepackage{wrapfig}
| \usepackage{soul}
| \usepackage{textcomp}
| \usepackage{marvosym}
| \usepackage{wasysym}
| \usepackage{latexsym}
| \usepackage{amssymb}
| \usepackage{hyperref}
| \tolerance=1000
| \usepackage{color}
| \usepackage{listings}
| \setlength{\parindent}{0pt}
| \setlength{\parskip}{1ex}
| \usepackage{listings}
| \usepackage{color}
| \definecolor{mylstback}{RGB}{200,200,200} % light gray
| \lstloadlanguages{R}
| \lstdefinelanguage{Renhanced}[]{R}{%
| morekeywords={acf,ar,arima,arima.sim,colMeans,colSums,is.na,is.null,%
| mapply,ms,na.rm,nlmin,replicate,row.names,rowMeans,rowSums,seasonal,%
| sys.time,system.time,ts.plot,which.max,which.min},
| deletekeywords={c},%
| alsoletter={._\%},%
| alsoother={:\$}}
| \lstset{%
| extendedchars=true,%
| basicstyle=\ttfamily\scriptsize, % the font that is used for the code
| tabsize=4, % sets default tabsize to 4 spaces
| numbers=left, % where to put the line numbers
| numberstyle=\tiny, % line number font size
| stepnumber=4, % step between two line numbers
| breaklines=false, %!! don't break long lines of code
| showtabs=false, % show tabs within strings adding particular underscores
| showspaces=false, % show spaces adding particular underscores
| showstringspaces=false, % underline spaces within strings
| frame=tb,%
| keywordstyle=\color{blue},
| identifierstyle=\color{black},
| stringstyle=\color{green},
| commentstyle={\color{red}\ttfamily\itshape},
| backgroundcolor=\color{mylstback}, % sets the background color
| captionpos=t, % sets the caption position to `bottom'
| extendedchars=false %!?? workaround for when the listed file is in UTF-8
| }
| \providecommand{\alert}[1]{\textbf{#1}}
| \author{Andreas Leha}
| \date{\today}
| \title{Test the listings}
| \hypersetup{
| pdfkeywords={},
| pdfsubject={},
| pdfcreator={Generated by Org mode 7.8.10 in Emacs 24.1.50.1.}}
| \begin{document}
|
| \maketitle
| \tableofcontents
| \vspace*{1cm}
|
|
|
| \section{Some listing}
| \label{sec-1}
| \begin{verbatim}
| bh <- basehaz(coxmodel.cont.64)
| \end{verbatim}
| % Generated by Org mode 7.8.10 in Emacs 24.1.50.1.
| \end{document}
`----
emacs-version: GNU Emacs 24.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2012-05-22 on zelenka, modified by Debian
org-version: Org-mode version 7.8.10 (release_7.8.10-573-g7b33d9 @ /home/andreas/local/emacs/org-mode-install/lisp/)
Any other idea, what I am doing wrong here?
Cheers,
Andreas
^ permalink raw reply [flat|nested] 5+ messages in thread