Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid new paragraph after code block in Org-mode?

When Org-mode exports to LaTeX it produces a new paragraph after code blocks. How can I avoid this?

Consider the following example:

#+TITLE: Example

#+BEGIN_SRC emacs-lisp
(setq foo "bar")
#+END_SRC
A paragraph contains some text and this text only serves as example text.
#+BEGIN_SRC emacs-lisp
(setq bar "foo")
#+END_SRC

It exports to the following LaTeX

\begin{verbatim}
(setq foo "bar")
\end{verbatim}



A paragraph contains some text and this text only serves as example text.

\begin{verbatim}
(setq bar "foo")
\end{verbatim}

which outputs as

The output I get

Note that the text after the first code block is set as a new paragraph. I do not want it to be set as a new paragraph. I want it to be set as

The output I want

which is the output of:

\begin{verbatim}
(setq foo "bar")
\end{verbatim}
A paragraph contains some text and this text only serves as example text.
\begin{verbatim}
(setq bar "foo")
\end{verbatim}

I am running Org-mode 7.6 in Emacs 23.3.1.

like image 273
N.N. Avatar asked Feb 25 '12 15:02

N.N.


2 Answers

This does not seem to be an issue in Org 7.8.03. Testing your exact code block provides the following output

Org
#+TITLE: Example

#+BEGIN_SRC emacs-lisp
(setq foo "bar")
#+END_SRC
A paragraph contains some text and this text only serves as example text.
#+BEGIN_SRC emacs-lisp
(setq bar "foo")
#+END_SRC
LaTeX
\begin{verbatim}
(setq foo "bar")
\end{verbatim}
A paragraph contains some text and this text only serves as example text.

\begin{verbatim}
(setq bar "foo")
\end{verbatim}
Output

Output result

like image 197
Jonathan Leech-Pepin Avatar answered Sep 28 '22 06:09

Jonathan Leech-Pepin


I'm afraid this is not the solution you want, but anyways, you can set indentation manually with

#+BEGIN_SRC emacs-lisp
(setq foo "bar")
#+END_SRC
#+LATEX:\noindent
A paragraph contains some text and this text only serves as example text.
#+BEGIN_SRC emacs-lisp
(setq bar "foo")
#+END_SRC
like image 40
Gabor Retvari Avatar answered Sep 28 '22 05:09

Gabor Retvari