Search code examples
org-mode

Prefix results with string when exporting to LaTeX


I have a source block whose code and results I would like to export to LaTeX:

    #+begin_src clojure :exports both
    (+ 1 2 3)
    #+end_src

I do M-x org-latex-export-to-pdf and get LaTeX rendered from source block. I would like the results to be prefixed by =>. How can I accomplish this?


Solution

  • You could do this by separating the export of the code from the export of the results:

    #+name: example
    #+begin_src octave :exports code
    1 + 2 + 3
    #+end_src
    \Rightarrow call_example[:exports results]().
    

    This uses the inline call feature for invoking named src blocks. Apologies for using octave; I do not have clojure installed.