centering source blocks in org-reveal presentations

The past two years, I’ve been using Emacs’ Org-Mode to create browser-based presentations. This requires Yujie Wen’s org-reveal.

This week, Yujie Wen helped me fix a tiny styling issue I had with src blocks. A slide will contain for example:

#+BEGIN_EXAMPLE
 #+BEGIN_SRC org
  “Using an open source desktop lowers the total cost of ownership by
  40%, in savings on proprietary software licences and by reducing costs
  on IT management.”
 ##+END_SRC
##+END_EXAMPLE

To center this quote, add this option to the presentation org file:

#+REVEAL_EXTRA_CSS: ./center.css

This points to a file “center.css”, which is in the same directory as the presentation org file. Contents of center.css:

.reveal pre { width: 50%; margin: auto; }