2

I have a simple org file, koe.org :

#+title:  Testing
#+author: Kari Marttila
#+date:   2022-06-10

#+OPTIONS: toc:2

#+PROPERTY: EXPORT_FILE_NAME koe.pdf

Testing

and a simple file, which comprises my latex/pdf conversion configuration, run-koe.el :

(require 'org)
(require 'ox-latex)
(require 'ox-publish)

(setq org-publish-project-alist
      '(
        ("org-koe"
         :base-directory "."
         :base-extension "org"
         :publishing-directory "."
         :recursive nil
         :publishing-function org-latex-export-to-pdf
         :headline-levels 4
         :auto-preamble t
         )
         ("org" :components ("org-koe"))
      ))

When I apply inside the org document in the Emacs editor, the command org-latex-export-to-pdf , both the tex file and the pdf file gets created correctly.

But if I run this setup in command line like this:

emacs -u "$(id -un)" --batch -l run-koe.el --eval '(org-publish-project "org" t)'

I get this output:

λ> emacs -u "$(id -un)" --batch -l run-koe.el --eval '(org-publish-project "org" t)'
Loading /etc/emacs/site-start.d/00debian.el (source)...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /home/kari/.emacs.d/customizations/shell-integration.el (source)...
Loading /home/kari/.emacs.d/customizations/navigation.el (source)...
Loading /home/kari/.emacs.d/.recentf...
Cleaning up the recentf list...
Cleaning up the recentf list...done (0 removed)
Loading /home/kari/.emacs.d/customizations/ui.el (source)...
Loading /home/kari/.emacs.d/customizations/editing.el (source)...
Loading /home/kari/.emacs.d/customizations/misc.el (source)...
Loading /home/kari/.emacs.d/customizations/elisp-editing.el (source)...
Loading /home/kari/.emacs.d/customizations/setup-clojure.el (source)...
Loading /home/kari/.emacs.d/customizations/setup-js.el (source)...
Loading /home/kari/.org-timestamps/org-koe.cache...
Publishing file /a/tmp/koe.org using ‘org-latex-export-to-pdf’
Output file: koe.pdf
Initializing asynchronous export process

There are two issues:

  1. I cannot figure out how to provide the pdf file name so that it is not asked interactively.
  2. No tex or pdf file gets generated.

I am using:

Ubuntu 20.04
GNU Emacs 26.3
Org 9.4.6
3
  • I experimented a little with org latex/pdf conversion. I just realized that maybe one way is to add all configuration inside the actual org document, and then just somehow in the command line run the latex/pdf conversion for the document. Jun 11, 2022 at 21:16
  • I experimented a bit with this and I now realize that it is better to have the configuration (toc, footnotes...) in the document itself. Jun 12, 2022 at 7:42
  • The only error is that you tried to use the export function rather than the publish function in your org-publish-project-alist for its publishing function. Otherwise, it works fine: see my answer.
    – NickD
    Nov 9, 2022 at 23:17

1 Answer 1

0

You cannot use org-latex-export-to-pdf as a publishing function: it does not have the right signature. Most (all?) exporters define a function for publishing, e.g. the manual uses org-html-publish-to-html in its example. You should try org-latex-publish-to-pdf instead of org-latex-export-to-pdf:

(setq org-publish-project-alist
      '(
        ("org-koe"
         :base-directory "."
         :base-extension "org"
         :publishing-directory "."
         :recursive nil
         :publishing-function org-latex-publish-to-pdf
         :headline-levels 4
         :auto-preamble t
         )
         ("org" :components ("org-koe"))
      ))
1
  • Just curious: did you try this and did it work?
    – NickD
    Jun 15, 2022 at 16:42

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.