1

I tried the suggestion at: Using KOMA-Script article with org-mode

When I try to export from an org file to LaTeX document class koma-article I get the message unknown LaTeX class 'scrartcl'.

Here is a MWE.

#+LATEX_CLASS: scrartcl
#+latex_class_options:

#+title: Mininum Working Example

* Opening Statement

 This is a minimal working example.

The following is in my init.el

(require 'ox-latex)
(with-eval-after-load "ox-latex"
(add-to-list 'org-latex-classes
             '("koma-article" "\\documentclass{scrartcl}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

I've inspected 'org-latex-classes and the koma-article data is in there.

Exporting to a LaTeX file with article class works. I can then change the class to scrartcl in TeX mode and create a pdf. It works, but I was wondering if there is a way to skip that step.

Thank you.

1
  • Have you tried: #+LATEX_CLASS: koma-article? I don't know org-mode, but I think, the name used for the org-latex-class should be used in the org-mode-document.
    – cabohah
    Oct 11, 2022 at 17:56

1 Answer 1

1

This is the docstring of org-latex-classes:

org-latex-classes is a variable defined in ox-latex.el.

Alist of LaTeX classes and associated header and structure. If #+LATEX_CLASS is set in the buffer, use its value and the associated information. Here is the structure of each cell:

(class-name  
  header-string
  (numbered-section . unnumbered-section)
  ...)

First entry in each list is the class-name which is the name you set with the #+LATEX_CLASS: in your .org file. So if you want to use the scrartcl, the entry in your init file should look like this:

(with-eval-after-load "ox-latex"
  (add-to-list 'org-latex-classes
               '("scrartcl" "\\documentclass{scrartcl}"
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                 ("\\paragraph{%s}" . "\\paragraph*{%s}")
                 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

Note that you don't need the form (require 'ox-latex) when you use with-eval-after-load.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .