0

When using Orgmode, we can generate/export HTML file or TXT file from ORG file, using C-c C-e(or M-x org-export), as described in https://orgmode.org/manual/The-Export-Dispatcher.html.

I wonder if possible to generate them using shell commands? like emacs --eval org-export --target-file my-notes.org?

1 Answer 1

2

try...

emacs my-notes.org --batch -l my_init_file.el -f org-latex-export-to-pdf

4
  • Got it! Thanks!
    – absuu
    Dec 12, 2022 at 14:24
  • As a supplement, I prefer no -l option, that is emacs my-notes.org --batch -f org-latex-export-to-pdf, which is more adaptive.
    – absuu
    Dec 12, 2022 at 14:39
  • 1
    The point however is that --batch deliberately skips loading your init file, so if you have any customizations that you need for the export, you will have to use a -l some-init-file.el. But some-init-file.el can be much simpler than the full init.el that you use for your interactive sessions, which generally has a lot of stuff in it that is not relevant just for exporting an Org mode file to PDF.
    – NickD
    Dec 12, 2022 at 14:42
  • See e.g. emacs.stackexchange.com/a/40957/14825
    – NickD
    Dec 12, 2022 at 15:07

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.