Simple Org-Mode File

L. Larrabee Strow

1 Code and Example Blocks

Code blocks, examples, prose, etc can be done a number of ways, two ways are shown below, see the source code of this document to see how these are done. In-line code.

An example block.  
% A matlab code snippet
  for i=1:n
    a(i) = fact(i);
  end

2 Figures

Orgmode has it's own syntax for including figures.

test.png

Figure 1: Another caption for a figure.

3 Math

To include a mathematical formula in-line using org-mode, just use normal latex syntax. Here is some in-line math a = α × β. For latex equations or displaymath just type them in the file as usual:

\begin{equation} \frac{n!}{k!(n-k)!} = \binom{n}{k}. \end{equation}

4 Lists

Lists work out of the box (enumerated or itemize).

An enumerated list:

  1. Just write a Markdown document, and sprinkle your LaTeX code snippets in between.
  2. Save the document with an .md suffix.
  3. Run the Pandoc conversion:

A bullet list:

  • Just write a Markdown document, and sprinkle your LaTeX code snippets in between.
  • Save the document with an .md suffix.
    • nested list
  • Run the Pandoc conversion:

5 Tables

Hugo is limited to simple tables, org-mode provides much more flexibility.

Here is a table using org-mode, followed by the code. Second row shows some fancy stuff you have to do to get horizontal lines in a table. The org-mode people evdiently don't like horizontal lines. See Orgmode manual: Column Groups

Table 1: The table caption
Name Age
Bob 27
Alice 23

Does text after table help the bottom rule to show up in some browers?

6 Table of Contents

You can get org-mode to produce your table of contents quite easily, you just have to put the following, #+TOC: headlines 2, on the line right after the #END_EXPORT command in your Hugo configuration sections at the top of the file. The "2" refers to how deep you want the table of contents sectioning.

7 Non Standard OrgMode for Hugo

7.1 Fancybox Browser (HTML export)

You can't use (as far as I can tell) orgmode to produce a fancybox figure browser. Here is how to do it using html escapes.

Figure caption in text page.

7.2 Nicer Code Listings (HTML export)

If you want to make this look like the Hugo markdown, there is a slightly more complicated way to do the above, shown below and then rendered.

% A matlab code snippet
      for i=1:n
        a(i) = fact(i);
      end

comments powered by Disqus