Revan
Revan

Reputation: 2322

Change font size of source code in org-reveal export

I have an org file with shell source code (but this happens also with python) that should be part of a reveal.js presentation.

#+BEGIN_SRC shell
  > ls -la
#+END_SRC

This code should not be evaluated, only shown in the presentation.

The source code is shown but it is very small. How can I change the font size of the source code?

And something else happens in the html file

The output shows these symbols:

ls -la

The html file of this line shows this

<pre  class="src src-shell">
&gt; ls -la&#57344;&#57345;&#57345;
...

Does anybody know how to fix this?

Upvotes: 5

Views: 4453

Answers (2)

user8167220
user8167220

Reputation:

I know this already has an accepted answer, and this post is approaching 3.5 years old, but I wanted to share the simple solution I used. Just wrapping the src block within a div using #+REVEAL_HTML, and specifying the font-size within the style does the trick.

(The CUDA code within the src block is just an example)

  #+REVEAL_HTML: <div style="font-size: 60%;">
  #+BEGIN_SRC cpp
template <typename data_type, op_type op> __global__ void stream_thread(data_type *ptr, const size_t size, data_type *output, const data_type val) {
    size_t tid = threadIdx.x + blockIdx.x * blockDim.x;
    size_t n = size / sizeof(data_type);
    data_type accum = 0;

    for (; tid < n; tid += blockDim.x * gridDim.x)
      if (op == READ)
          accum += ptr[tid];
      else
          ptr[tid] = val;

    if (op == READ)
        output[threadIdx.x + blockIdx.x * blockDim.x] = accum;
}
  #+END_SRC
  #+REVEAL_HTML: </div>

Upvotes: 11

Revan
Revan

Reputation: 2322

Found the answer myself. The font size of the source code can be modified by an additional CSS file.

In the org file:

#+REVEAL_EXTRA_CSS: ./modifications.css

In modifications.css

.reveal pre {
    font-size: 1em;
}

I have no clue about this strange symbols, could not reproduce them on another installation.

Upvotes: 3

Related Questions