6
votes

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.

2

2 Answers

2
votes

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

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

2
votes

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