Frage

Whenver I want to export a source code block with it's results, I want to add some text in-between, e.g. "Output:", because otherwise is very hard for the reader to understand where the program ends and the output begins - how do I achieve adding "Output:" in-between?

Example:



* Test
  #+BEGIN_SRC python :results output :exports both
i = 5
print i
i = i + 1
print i

s = '''This is a multi-line string.
This is the second line.'''
print s
  #+END_SRC

  #+RESULTS:
  : 5
  : 6
  : This is a multi-line string.
  : This is the second line.

War es hilfreich?

Lösung

You need to name your source code block. Then, and only then, you can put your results part wherever you want, even before the source code block.

EDITED (add ECM):

#+name: my-block
#+begin_src emacs-lisp
(message "hello")
#+end_src

I can put paragraphs here...

#+results: my-block
: hello
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top