I have been using org-mode + emacs for a while now, and I love how easy it is to produce contents. I often use the html + pdf export combo from the same document (first, a web page, following, a pdf document). My problem is about exporting code blocks (#+BEGIN_SRC
...) to pdf.
To html, the export command (C-c C-e h h
) gives me a satisfactory solution: it uses a frame to encapsulate the code (showing the programming language when you rest the mouse pointer on it) and uses a different frame for the resulting messages (as I set :export both
). When using #+CAPTION: my caption here
before the #+BEGIN_SRC
, resulting html page includes "Listing #: my caption here" before the code frame.
To pdf, the document generated by export command (C-c C-e l p
) doesn't have frames around neither code or results (a real mess), and captions show up as "Figure #: my caption here" in between the code and results.
How do I get both different frames for code and results and Listings-like captions for my code blocks when exporting from org-mode to pdf?
Here is a minimal example:
#+TITLE: EXPORT TESTINGS
#+OPTIONS: toc:nil
#+CAPTION: Caption, my caption!
#+BEGIN_SRC C :results output :exports both
int i, x = 10;
for(i = 0; i < x; i++)
printf("%d ",i);
printf(" ~ %d\n", x);
#+END_SRC