3

I'd like to export an org file to LaTeX from the command line. I have created a file export.el with the following contents (simplified to reproduce the problem):

(require 'org)

(when (not (assoc "scrreprt" org-latex-classes))
  (push '("scrreprt"
          (assoc "report" org-latex-classes))
        org-latex-classes))

 (with-current-buffer (find-file-noselect "contents.org")
   (org-latex-export-to-latex nil nil nil t)))

And then I tried to run it from the shell:

$ emacs -Q --batch -l export.el 
Symbol's value as variable is void: org-latex-classes

It seems that I am missing some org functionality. How do I find out what else I have to require in order to get org-latex-classes defined?

(Omitting the -Q option does not help either, but even if it helped my question about finding the right require would stand).

1 Answer 1

3

I presume you have access to org-latex-classes when you start up Emacs for interactive use, so something in your init file is loading it. You can check which library defines org-latex-classes with C-h v org-latex-classes (or describe-variable). It tells you that

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

As such, you also need to (require 'ox-latex) for Emacs to recognize that variable. It should also work to (require 'ox) instead.

Also see this SuperUser post on the question.

0

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.