all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* new latex exporter
@ 2013-03-15 17:59 Rick Frankel
  0 siblings, 0 replies; only message in thread
From: Rick Frankel @ 2013-03-15 17:59 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-15 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15 17:59 new latex exporter Rick Frankel

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.