From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: new latex exporter Date: Fri, 15 Mar 2013 13:59:00 -0400 Message-ID: <7B54CD4D-8BD5-4676-9B81-DBEE275B20C2@rickster.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGYuM-0001sZ-Gg for emacs-orgmode@gnu.org; Fri, 15 Mar 2013 13:59:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGYuG-0000bc-QT for emacs-orgmode@gnu.org; Fri, 15 Mar 2013 13:59:10 -0400 Received: from [204.62.15.78] (port=52449 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGYuG-0000bT-NE for emacs-orgmode@gnu.org; Fri, 15 Mar 2013 13:59:04 -0400 Received: from [10.241.7.59] (50.sub-174-252-7.myvzw.com [174.252.7.50]) by mail.rickster.com (Postfix) with ESMTPSA id DA4B9253A0 for ; Fri, 15 Mar 2013 13:59:02 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org There is a problem (bug?) with ox-latex and long listings. If the listing has a label (name) or caption, it is wrapped in a '\begin{listing}[H]' block even when the org-latex-listings type is set to 'minted. This causes listings longer than one page to be truncated if they have labels, which means you can't have callable code longer than one page (~40 lines for US Letter paper.) An example document (with a proposed solution) is below. --- #+TITLE: Test #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:{} -:t f:t *:t <:t * Setup and short examples :PROPERTIES: :EXPORTS: code :END: *NOTE:* Run this section to generate the long examples before generating the latex/pdf output. ** latex listing options #+BEGIN_SRC elisp :results silent (setq org-latex-listings 'minted org-latex-minted-options '(("linenos" "true") ("stepnumber" "5") ("numbersep" "0.25em") ("frame" "leftline") ("framerule" "1pt") ("rulecolor" "\\color{framecolor}"))) #+END_SRC ** patch #+BEGIN_SRC diff :eval never diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 8a24aea..388eb2e 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2160,7 +2160,7 @@ contextual information." ;; Case 3. Use minted package. ((eq org-latex-listings 'minted) (let ((float-env - (when (or label caption) + (when caption (format "\\begin{listing}[H]\n%%s\n%s\\end{listing}" (org-latex--caption/label-string src-block info)))) (body #+END_SRC ** source w/ no label #+BEGIN_SRC perl :eval never foreach my $i qw(with without) { print join( "\n", sprintf("* Long listing %s label", $i), ($i eq 'with' ? '#+name: long-listing' : ''), "#+BEGIN_SRC perl :exports code", (map { "print '$_'" } 1..60), "#+END_SRC\n", ); } #+END_SRC ** src w/ with label #+name: generate-listing #+BEGIN_SRC perl :results raw foreach my $i qw(with without) { print join( "\n", sprintf("* Long listing %s label", $i), ($i eq 'with' ? '#+name: long-listing' : ''), "#+BEGIN_SRC perl :exports code", (map { "print '$_'" } 1..60), "#+END_SRC\n", ); } #+END_SRC #+RESULTS: generate-listing