3

Is it possible to export an *.org file to LaTeX file, without the usual preamble of \documentclass[...]{article} and a number of \usepackage[]{xyz}, yet take advantage of LaTeX and org-mode's math and calculation power?

I have EMACS+AUCTeX and TexLive 2013 installed on a 32-bit Windows 7 machine.

  • 1
    Does this answer on StackOverflow help? – Henri Menke Nov 26 '14 at 17:24
  • @HenriMenke I don't think org-export-as-latex is still part of org mode, with the newer org-export-dispatch system. However, following your link lead me in a roundabout way to a better solution, which I've posted below. – Tyler Nov 26 '14 at 17:49
3

Edit

I was wrong, you can do this with normal org mode commands.

C-c C-e will invoke org-export-dispatch

This brings up the Export Dispatcher buffer. You'll notice the option for Body Only at the top, which is toggled with C-b. Set it to On, and then complete your export with l l (or whatever you like).

I'll leave my original, though now unnecessary, pandoc solution below.

Original answer using pandoc

An inelegant solution using pandoc. From the command line, the following provides the org -> latex conversion without producing any header text:

pandoc -o file_name.tex file_name.org

This assumes your file is called "file_name.org". A bit of elisp to call this function from within Emacs, while you're visiting the file you wish to export:

(defun my-export-to-tex ()
  "Export this buffer from org to latex."
  (interactive)
  (async-shell-command 
   (concatenate "pandoc -o "
                (file-name-base buffer-file-name)
                ".tex " buffer-file-name)))
  • Tyler, thank you for your input. I don't have time now to experiment and troubleshoot emacs so to avoid distractions I have since uninstalled both AUCTeX and emacs. – WobblyWindows Dec 6 '14 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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