Context I am embedding org-mode source code blocks and their results into my document and am exporting it to LaTeX. I usually wrap the output of my code into helper functions that generate formatted LaTeX code, for example equation environments or TikZ graphics.
Question
Unfortunately I stumbled over blank lines after the results block leading to new paragraphs in the LaTeX document. Do you see a reasonin org-mode
for this behauvior?
Related
On StackOverflow there is a question regarding newline characters at the end of each python print
invocation but this does not resolve the issue:
StackOverflow: Print to the same line and not a new line in python
Modifying the end
paramter of print
does only insert abc before the newline but is not replacing it.
print('\\begin{equation}c+d\\end{equation}', end='abc'),
Minimum working example:
#+TITLE: Blank lines after source block results on export
#+LaTeX_HEADER: \usepackage{lsthighlight}
* Example
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
#+BEGIN_SRC python :exports results :results output latex
print('\\begin{equation}a+b\\end{equation}')
#+END_SRC
and
#+BEGIN_SRC python :exports results :results output latex
print('\\begin{equation}c+d\\end{equation}')
#+END_SRC
will result in blank lines after the result listing in the exported
LaTeX document.
LaTeX export:
\section{Example}
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
\begin{equation}a+b\end{equation}
and
\begin{equation}c+d\end{equation}
will result in blank lines after the result listing in the exported
\LaTeX{} document.
Instead it should be exported as follows:
\section{Example}
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
\begin{equation}a+b\end{equation}
and
\begin{equation}c+d\end{equation}
will result in blank lines after the result listing in the exported
\LaTeX{} document.
I really have no idea where to look for this issue. That's why I have the hope that you can help me with this. Thank you!
org-latex-export-as-latex
, do you have a variable set somewhere that asserts that equations must be exported? They are simply ignored at export time on my system.(org-babel-do-load-languages 'org-babel-load-languages '((python . t))) (setq org-confirm-babel-evaluate nil)
.emacs-lisp :exports results :results value latex
block containing(print "foo")
.