0

I recently started using Spacemacs. With the default configuration, everithing works fine, but I would like to change a few configurations to org-mode, so i changed the dotspacemacs/user-config function to this:

(defun dotspacemacs/user-config ()
  (with-eval-after-load 'org
    (unless (boundp 'org-latex-classes)
      (setq org-latex-classes nil))
    (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}")))
    (org-babel-do-load-languages 'org-babel-load-languages
                                 '((dot . t)
                                   (maxima . t)
                                   (python . t)))
    (setq org-babel-python-command "python3")
    ;; Settings to export code with `minted' instead of `verbatim'.
    (setq org-export-latex-listings t)
    (setq org-latex-listings 'minted
          org-latex-packages-alist '(("" "minted"))
          org-latex-pdf-process
          '("pdflatex -shell-escape -intera")))
  )

After that, every time I try to export an org file to LaTeX I receive the following error:

user-error: Unknown LaTeX class ‘article’

What is happening? What did I do wrong? How do I fix it? Thanks in advance.

1 Answer 1

2

You blew the default value of org-latex-classes away in line 4. Try this instead. I'm waiting for ox-latex to load before touching org-latex-classes.

(defun dotspacemacs/user-config ()
  (with-eval-after-load 'org
    (org-babel-do-load-languages 'org-babel-load-languages
                                 '((dot . t)
                                   (maxima . t)
                                   (python . t)))
    (setq org-babel-python-command "python3"))
  (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}")))
    ;; Settings to export code with `minted' instead of `verbatim'.
    (setq org-export-latex-listings t)
    (setq org-latex-listings 'minted
          org-latex-packages-alist '(("" "minted"))
          org-latex-pdf-process
          '("pdflatex -shell-escape -intera"))))
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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