Emacs 如何在源代码和导出到PDF的结果之间添加一些文本?
当我想导出带有结果的源代码块时,我想在它们之间添加一些文本,例如“Output:”,因为否则读者很难理解程序从哪里结束,输出从哪里开始-我如何实现在两者之间添加“Output:” 例如:Emacs 如何在源代码和导出到PDF的结果之间添加一些文本?,emacs,org-mode,org-babel,Emacs,Org Mode,Org Babel,当我想导出带有结果的源代码块时,我想在它们之间添加一些文本,例如“Output:”,因为否则读者很难理解程序从哪里结束,输出从哪里开始-我如何实现在两者之间添加“Output:” 例如: * 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.'''
* 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.
您需要命名您的源代码块。然后,也只有这样,您才能将结果部分放在任何您想要的地方,甚至放在源代码块之前 已编辑(添加ECM):
也许我们应该把这个放在常见问题中。你能添加MWE来演示解决方案吗?
#+name: my-block
#+begin_src emacs-lisp
(message "hello")
#+end_src
I can put paragraphs here...
#+results: my-block
: hello