This is a new error, and I haven't really changed anything in my config. The relevant portion is below

(use-package org
  (setf (cdr (assoc 'file org-link-frame-setup)) 'find-file)
  (setq org-directory "~/Documents/Lists/org")
  (setq org-agenda-files '("~/Documents/Lists/org/todo.org"
  (setq org-log-done 'time) ; Log the time an org task is set to done.
  (setq org-priority-default 67)
  (setq org-agenda-window-setup 'current-window)
  (setq org-agenda-sort-notime-is-late nil)
  (setq org-agenda-span 10)
  (setq org-agenda-start-day "-3d")
  (setq org-export-babel-evaluate nil)
  (setq org-latex-caption-above nil)
  (setq org-preview-latex-process-alist
        '((dvipng :programs
                  ("latex" "dvipng")
                  :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
                  (1.0 . 1.0)
                  ("latex -interaction nonstopmode -output-directory %o %f")
                  ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
          (dvisvgm :programs
                   ("latex" "dvisvgm")
                   :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
                   (1.7 . 1.5)
                   ("latex -interaction nonstopmode -output-directory %o %f")
                   ("dvisvgm %f -n -b min -c %S --currentcolor -o %O")) ; currentcolor is important
          (imagemagick :programs
                       ("latex" "convert")
                       :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
                       (1.0 . 1.0)
                       ("pdflatex -interaction nonstopmode -output-directory %o %f")
                       ("convert -density %D -trim -antialias %f -quality 100 %O"))))
  (add-to-list 'org-latex-classes
         ,(concat "\\documentclass[presentation]{beamer}\n"
         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
  (setq org-latex-listings 'minted
    org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
                "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
  (plist-put org-format-latex-options ':scale 1.1)
  (plist-put org-format-latex-options :foreground nil)
  (plist-put org-format-latex-options :background nil)
  (setq org-latex-packages-alist
           '(("" "tikz" t)
         ("" "tikz-cd" t)
         ("" "minted")))
  (setq org-latex-create-formula-image-program 'dvisvgm)
  (defun my/resize-org-latex-overlays ()
    (cl-loop for o in (car (overlay-lists))
       if (eq (overlay-get o 'org-overlay-type) 'org-latex-overlay)
       do (plist-put (cdr (overlay-get o 'display))
             :scale (expt text-scale-mode-step
  (org-babel-do-load-languages 'org-babel-load-languages '((python . t)
                               (latex . t)))
  (org-mode . (lambda () (add-hook 'text-scale-mode-hook #'my/resize-org-latex-overlays nil t)))
  (org-mode . (lambda () (org-indent-mode 1) (visual-line-mode 1))))

If I do counsel-describe-variable and search for org-latex-classes it does not find anything. Has something changed recently?

  • 2
    What did change? Did you upgrade any packages? Did you upgrade Emacs? Did you change anything at all in your config? Add that information to your question.
    – db48x
    Commented Feb 17 at 7:36

1 Answer 1


The config section is run after the org package is loaded, but loading the org package alone does not define org-latex-classes. That is defined in ox-latex, so you either need to explicitly require ox-latex or you need for it to be loaded during config:

  (require 'ox-latex) ; <-----------Add this.
  (add-to-list 'org-latex-classes

Note that add-to-list needs to have the variable defined before it is called: it adds an element to the variable's current value, so the variable has to have a current value. Note for example, that the same problem does not arise with org-preview-latex-process-alist (which is also defined in ox-latex) because you are using setq, so you either create the variable (if it does not exist already) or you clobber its current value (if it does), so it does not matter whether ox-latex is already loaded or not.

As to why it worked before, who knows? You may have added the add-to-list recently and have not restarted Emacs since then, or you may have updated Emacs or some package as @db48x suggests in a comment. If you updated, then maybe post your previous version and your current version and we can check if the require was present in the earlier version and was deleted in the current version. But without that kind of information, it's difficult to guess.

Your Answer

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

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