3
votes

In emacs org-mode, is it possible to apply markup to the RESULTS section of a SRC block output when exporting to PDF (or any export format)?

For example, here is a src code block:

#+BEGIN_SRC python :results output :exports both
print '*I would like this line to be bold*'

#+END_SRC

#+RESULTS:
: *I would like this line to be bold*

The RESULTS section is generated by the usual C-c C-c.

Normally org-mode will mark up text in * as bold, but it obviously doesn't do this if that text is in a RESULTS block (or, it appears in a SRC block). In my example, if I export this (PDF via Latex) then I just get the exact output of

*I would like this line to be bold*

...there's no markup.

1
I'm voting to close this question as off-topic because it belongs to emacs.stackexchange.comceving

1 Answers

2
votes

Answering my own question.

There are formatting modifiers you can add in the header section of the SRC block to do what I want. One of them is 'raw'.

#+BEGIN_SRC python :results output raw
print '*I would like this line to be bold*'
#+END_SRC

#+RESULTS:

*I would like this line to be bold*

(Ironically on Stack Overflow I'm not sure how to mix code blocks and bold face, but the bold line is the result of running the code block in org-mode).

There is a full list of ways to format output here:

http://orgmode.org/manual/results.html#results