/org-document-test

A document to test export formats from org

Primary LanguageTeX

Which is a good format to make documents?

The problem

I want to have a format that I can convert to pdf, html, and maybe odt. The formats I know well are

  • LaTeX
  • org

One thing I like about org is that it is rather simple, and the documents look clean. I do not like that it seems to change constantly and that it is not as universally known as LaTeX.

This is stuff to be centered.

  1. A first item in a list.
  2. Another item
    1. With three subparts. This one.
    2. Another one.
    3. <<last>> And the last subpart.

Requirements

I want to use:

  • links, say Google.
  • images, say the one in Figure clock.

    ./clock.png

    Apparently one has to have a blank line so that the image looks OK. Also, with a caption, the image is centered both in LaTeX and HTML export.

    Images can have a caption and not be centered in LaTeX, see orgmode.org Git.

    ./clock.png

Centering two images side by side. See {O} Centering side-by-side images in latex/pdf export.

./clock.png

./clock.png

Other requirements

Code

  • code, say
    def test(a):
        """This is just a test
        
        Arguments:
        - `a`: test argument
        """
        
  • more code, using the new syntax introduced at [2014-03-26 Wed]:
    def filter_small_local_girth ( L ):
        i = 0
        result = []
        while i < len(L):
            hasit = (Graph(L[i]).girth()>=7)
            if not(hasit):
                result.append(L[i])
            i = i+1
            print i, hasit
        return result
        
  • A code listing with caption
    \begin{equation}
      a^{2}+b^{2}=c^{2}
    \end{equation}
        

Math

  • math symbols, say \(a2+b2=c2\)
  • displayed equations, like:

    \begin{equation} a2+b2=c2 \end{equation}

R graphics

Graphviz

  • Graphviz
    digraph "foo" {
      rankdir=LR;
      params -> builders;
      builders -> objects;
      objects -> file;
    }
        

    #+RESULTS[6d9e47adf125517b3e395a4143174b0f35bae46c]: graphviz.png

Tikz

  • A tikz picture, that exports well to both \LaTeX{} and HTML.
    % from http://www.texample.net/tikz/examples/cycle/
    \begin{tikzpicture}[scale=0.5]
      \def \n {5}
      \def \radius {3cm}
      \def \margin {8} % margin in angles, depends on the radius
      
      \foreach \s in {1,...,\n}
      {
        \node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$};
        \draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius) 
        arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
      }
    \end{tikzpicture}
        

    #+RESULTS[10459562657201717ce8d59bcee5b6a75e3032ac]: test-tikz test-tikz.png

  • And another, this time with caption. And references: see Figures diamond and clock.
    \begin{tikzpicture}
      \draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
    \end{tikzpicture}
        

Theorems

  • theorems, definitions, etc.

    A definition:

  • references, to a bibliographic resource or to another theorem previously stated. Like: see Theorem thm-1 and Definition def-closed.
  • tables, say:
    abc
    xyz

Misc

This block produces a picture of the code:

\(
\frac{1}{2}
\)

References in beamer

The following org file when exported to beamer, contains a reference in one slide to other. See user labels in beamer export.

#+TITLE: LaTeX export minimal test

* Intro
  :PROPERTIES:
  :CUSTOM_ID: introduction
  :END:
This is the first slide.

* Summary
As we saw on slide [[#introduction][intro]], this is interesting.

* COMMENT Local Variables

# Local Variables:
# org-latex-prefer-user-labels: t
# End:

Resources

In blogs

blogs in org

github

References

To the equation

We reference equation the-equation and table the-table and Theorem thm-1 and Figure clock. And also item last. And to a named code block: Listing latex-code. And Figure diamond.

To books

We cite cite:posetfiber. Let us also cite cite:MR2522486.

Note that to export bibliographies to html, one has to install bibtex2html. For bibtex2html to work, we need to add

openout_any = a

to the local texmf.cnf file, say /usr/local/texlive/2014/texmf.cnf. Care has to be taken that the last line has a line ending character, see {tex-live} texmf.cnf ignored.

State of the references

Currently, on [2016-10-02 Sun], with org-version:

Org-mode version 8.3.6 (release_8.3.6-1187-geda8ac @ /home/rafael/.emacs.d/site-lisp/org-mode/lisp/)
pdfhtml
figuresworksworks
equationsworks
tablesworksworks
theoremsworks
biblioworksworks
items in listsworksworks
code listingsworks