From: Nick Dokos <nicholas.dokos@hp.com>
To: emacs-orgmode@gnu.org
Cc: nicholas.dokos@hp.com
Subject: BUG: example/src blocks and latex export
Date: Fri, 19 Aug 2011 06:09:31 -0400 [thread overview]
Message-ID: <6977.1313748571@alphaville.dokosmarshall.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2194 bytes --]
Consider the following org file:
--8<---------------cut here---------------start------------->8---
* foo
Verbiage to begin the paragraph
#+begin_src shell
get-config.py var section [section ...]
#+end_src
and verbiage to end the same paragraph.
* bar
Verbiage to begin the paragraph
#+begin_example
get-config.py var section [section ...]
#+end_example
and verbiage to end the same paragraph.
--8<---------------cut here---------------end--------------->8---
When exported to latex with current git (Org-mode version 7.7 (release_7.7.120.g2edd.dirty)),
I get:
--8<---------------cut here---------------start------------->8---
Verbiage to begin the paragraph
\begin{verbatim}
get-config.py var section [section ...]
\end{verbatim}
and verbiage to end the same paragraph.
\section{bar}
\label{sec-2}
Verbiage to begin the paragraph
\begin{verbatim}
get-config.py var section [section ...]
\end{verbatim}
and verbiage to end the same paragraph.
--8<---------------cut here---------------end--------------->8---
so both instances of "verbiage to end the same paragraph" actually end
up being in a different paragraph, with three empty lines after a
source block and two empty lines after an example block, where none
existed before. LaTeX indents the newly created paragraph and it
looks ugly. Of course, just a single empty line is enough to do
the damage, but the fact that there is more than one and that there
are different numbers, indicates multiple places where a gratuitous
newline is inserted.
I get sane behavior with the attached patch, but I'm wondering if it
breaks other backends, so if somebody is willing to test, I'd appreciate
it (and of course, I'll test as well). For the time being at least, this
is a trial balloon, not a real patch.
ISTR this issue coming up on the list recently: did I imagine it? If
not, could somebody provide a reference? My feeble attempts at searching
gmane were unsuccessful. I did find an old thread between Nicolas Girard
and Carsten and apparently things were fine for a while. Or I may be
thinking about Tom Dye's problem with lists embedded in a paragraph.
about a month ago, but this is a different problem.
Thanks,
Nick
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH} Eliminate extra newline(s) after example or src block. --]
[-- Type: text/x-lisp, Size: 2062 bytes --]
From b267aacef1e767cf6ba6d0d9aa8cb4109c7685d3 Mon Sep 17 00:00:00 2001
From: Nick Dokos <nick@dokosmarshall.org>
Date: Fri, 19 Aug 2011 05:02:57 -0400
Subject: [PATCH] Eliminate extra newline(s) after example or src block.
Signed-off-by: Nick Dokos <nick@dokosmarshall.org>
---
lisp/ob-exp.el | 2 +-
lisp/org-exp.el | 2 +-
lisp/org-latex.el | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 9da0487..d1b13c8 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -231,7 +231,7 @@ The function respects the value of the :exports header argument."
(defun org-babel-exp-code (info)
"Return the original code block formatted for export."
(org-fill-template
- "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC\n"
+ "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC"
`(("lang" . ,(nth 0 info))
("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info)))
("body" . ,(nth 1 info)))))
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 740f195..a2a2fb3 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2718,7 +2718,7 @@ INDENT was the original indentation of the block."
"\n#+BEGIN_" backend-name "\n"
(org-add-props rtn
'(org-protected t org-example t org-native-text t))
- "\n#+END_" backend-name "\n\n"))
+ "\n#+END_" backend-name "\n"))
(org-add-props rtn nil 'original-indentation indent))))
(defun org-export-number-lines (text &optional skip1 skip2 number cont
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index f46f9f5..17626b5 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -401,7 +401,7 @@ will pass them (combined with the LaTeX default list parameters) to
:type 'plist)
(defcustom org-export-latex-verbatim-wrap
- '("\\begin{verbatim}\n" . "\\end{verbatim}\n")
+ '("\\begin{verbatim}\n" . "\\end{verbatim}")
"Environment to be wrapped around a fixed-width section in LaTeX export.
This is a cons with two strings, to be added before and after the
fixed-with text.
--
1.7.5.1.169.g505a1
next reply other threads:[~2011-08-19 10:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-19 10:09 Nick Dokos [this message]
2011-08-19 13:49 ` BUG: example/src blocks and latex export Eric Schulte
2011-08-19 15:27 ` Nick Dokos
2011-08-19 19:59 ` Nick Dokos
2011-08-19 21:27 ` Bastien
2011-08-19 22:03 ` Nick Dokos
2011-08-19 23:11 ` Nick Dokos
2011-08-21 18:30 ` Eric Schulte
2011-08-21 18:28 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6977.1313748571@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.