Sorry, previous mail seems to have gotten munged, lets' try again.

There is a 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. 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) and print it with minted.

The problem is on line 2178 of ox-latex:
 
  (when (or label caption)

should probably be:
       
  (when caption


An example document is below.

rick

---
#+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

** 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


Reply via email to