5

By default org mode seems to configure 8x11 as the paper type when I export to latex. I always print to A4, so I would like all of my exports to specify a4 as the paper type -- e.g.:

\documentclass[a4paper]{article}

I currently solve the problem by putting the following line in my file whenever I want to export, but that's pretty redundant:

#+LaTeX_CLASS_OPTIONS: [a4paper]

How can I tell emacs to do this whenever I run latex export?

  • I believe that the default is taken from the default LaTeX clas, i.e. #+LaTeX_CLASS: article I think. See the value of org-latex-default-class to figure out what it is. – wvxvw Sep 23 '15 at 11:18
5

You need to configure the org-latex-classes variable. Normally something like the following does the trick:

(add-to-list 'org-latex-classes
         '(("article" "\\documentclass[11pt,a4paper]{article}"
            ("\\section{%s}" . "\\section*{%s}")
            ("\\subsection{%s}" . "\\subsection*{%s}")
            ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
            ("\\paragraph{%s}" . "\\paragraph*{%s}")
            ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

However in this case there is a default class called article. Editing that entry in the list is a bit non-trivial. So I suggest just creating your own, say a4article. Just replace the "article" in the above example with "a4article". You can find many other examples in my Emacs setup.

  • Is editing inplace necessary? One can usually push a new element to the almost and the older one will be ignored – YoungFrog Dec 5 '16 at 5:58
  • I'm not sure I understand the question, do you mean, why not add a duplicate "article" entry in org-latex-classes? As it's a list, duplicate entries can lead to unpredictable behaviour. If you rather edit in-place, have a look at my emacs setup (link provided in the answer), there are some examples for that as well (for a different org-latex variable). – suvayu Dec 8 '16 at 6:17
  • I mean that this variable is documented to be an "Alist" (I just checked). When searching an association list for an association with a given key, the first one found is returned, if there is more than one. (see (info "(elisp) Association Lists")). – YoungFrog Dec 8 '16 at 20:34
  • 1
    There are too many brackets around the second argument of add-to-list. Should be (add-to-list 'org-latex-classes '("article" ... . – Timm Apr 28 '17 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.