Still learning to walk
I am still using org-mode for organising thoughts, but now I’ve also done a few simple documents for export too. For example, I put out some monthly updates for a local volunteer group, written by someone else which I ingested via pandoc
and exported to PDF and markdown (for use with WordPress). Hitherto, I had been ingesting docx, pandoc-ing to LaTeX, manually fixing bits and pieces up and rewriting things in LaTeX, like making things lists- but this was somewhat cumbersome. By using an org document as the, er, ‘master intermediary’ format, it was much quicker to work in.
I have also prepared a couple of reports, which I was previously drafting first in LaTeX, then in markdown. Here, the final output format is .docx, but reading that is not easy on the eyes as compared to a LaTeX-backed PDF. I’m not sure it’s any quicker to work in emacs/org as opposed to vim/markdown, but for now I will stick with it for the purposes of learning and keeping access to the rest of the org/emacs ecosystem (agenda etc).
On to the tips and steps!
My Table of Contents / TOC is Red?
#+LATEX_HEADER: \hypersetup{colorlinks,urlcolor=blue,linkcolor=black}
I ran into this after removing the boxed links. More of a “remember to set all the LaTeX package options” than an emacs/org tip, but other will probably run into it in this context.
Much better!
How do I include an image? And how do I resize it?
#+ATTR_LATEX: :scale 0.2
[[/path/to/image.jpg]]
Images you can set up as regular links (C-c C-l); but make sure the path is correct- export will not work unless emacs can find the target.
You can set additional options, see 13.10.6 Images in LaTeX export.
How do I include a bunch of LaTeX?
You have a couple of options. You can write plain LaTeX in an org-mode document, which gets parsed by the exporter. This seems to work okay for many things, but to me it seems… out-of-place. Like writing a mixed HTML/CSS and PHP document, although it does what you want it to (for now) it feels like the two should be separated.
That being the case I like to wrap it in a #+begin_export
block, in this case #+BEGIN_EXPORT LATEX
:
#+begin_export latex
\maketitle
\begin{center}
\includegraphics[scale=0.2]{./amnesty-candle-black2.jpg}\par
\vspace{1.2cm}
{\Huge\textbf{Glasgow West Amnesty International}}
\end{center}
\tableofcontents
\vspace{0.6cm}
#+end_export
How do I use a template document?
By using #+SETUPFILE
, as suggested by joon in this answer.
#+SETUPFILE: template.org
(...)
template.org:
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper]
#+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage{geometry}
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage{amssymb,amsmath}
#+LATEX_HEADER: \usepackage{ifxetex,ifluatex}
#+LATEX_HEADER: \usepackage{afterpage}
#+LATEX_HEADER: \usepackage{tcolorbox}
#+LATEX_HEADER: \hypersetup{colorlinks,urlcolor=blue,linkcolor=black}
#+LATEX_HEADER: \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
#+LATEX_HEADER: \usepackage{parskip}
Is there anything else I should know about exporting to LaTeX?
As I mentioned at the start, my needs have been relatively simple. There is a decent tutorial on the org-mode website, albeit for versions < 8.0. Much of the information I’ve found scattered across QAs is in the first few sections.
Exporting to Markdown
The markdown backend needs to be enabled: M-x customize-option
? org-export-backends
? enable md
(by pressing enter on checkbox, then [ Apply and Save ]
. See 13.11 Markdown Export in the org manual.
From there it can be used with C-c C-e m m
(command, export, markdown, to markdown file)