I'm trying to modify my .emacs to create my own classes,

I tried this article and using org-latex rather than ox.

I also tried this different approach.

I tried enclosing the above classes with with-eval-after-load 'org-latex as suggested in another post.

Yet I can't seem to have my classes working when I input : #+LATEX_CLASS: myclass in an org file. (In my case, #+LATEX_CLASS: notes)

Using either "notes" or "article" in the \documentclass{} does not change anything.

I only get the same message all the time :

user-error: Unknown LaTeX class ‘notes’

N.B : Here is my init file

1 Answer 1


Your init file defines a notes class that can be used by org when exporting to LaTeX:

#+LATEX_CLASS: notes

It works fine, in the sense that it produces a latex output that starts out like this:


But then, the org exporter calls pdflatex (or xelatex or something else depending on your setup) to process the LaTeX file. And guess what: pdflatex chokes because there is no notes.cls class file. pdflatex returns an error and org duly reports it. IOW, this is a problem that LaTeX encounters; the org exporter is just the bearer of the bad news.

Note that in your second link, the author defines a class bjmarticle that can be used with the #+LATEX_CLASS directive in the org file, but that is defined in terms of the standard article LaTeX class:

(add-to-list 'org-latex-classes
               ...rest elided...

so the LaTeX file that is produced starts with


which causes no problems: the LaTeX processor knows about the article class.

So you either have to define your org-mode notes class in terms of a LaTeX class that exists on your system or install a notes class into your LaTeX installation (assuming that such a class exists).

BTW, unless your org mode installation is really old, you need ox-latex, not org-latex in your init file:

(with-eval-after-load 'ox-latex
  (add-to-list 'org-latex-classes

The blog posts you found are from 2011 and 2015 resp. and org mode has changed substantially since then. Because of that, it's always a good idea to report your version - just do:

M-x org-version

and add it to your question.

EDIT: Here are some debugging hints:

  • If you are on Linux (or some sort of Unix system), then kpsewhich can tell you whether a LaTeX class exists on your system:
$ kpsewhich article.cls
$ kpsewhich notes.cls

I don't know if that's available on Windows.

  • When you export an org file foo.org to PDF, a LaTeX file foo.tex is produced. You can try to process that file on the command line and see if you get errors:
pdflatex foo.tex

You might need to add the --shell-escape option, depending on your setup:

pdflatex --shell-escape foo.tex
  • When the exporter tries to export to PDF, the output of the LaTeX processor ends up in an emacs buffer called *Org PDF LaTeX Output* which you can visit with C-x b. That's another way to see whether there are errors in the LaTeX processing.
  • Thanks to you I went back to my file and changed it to ox-latex, updates all packages. I'm using org 9.1 something. I exported to Latex and worked my way from there, reading the log. Thanks again ! Commented Aug 21, 2019 at 9:33
  • Glad it helped!
    – NickD
    Commented Aug 21, 2019 at 17:33

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.