2
votes

Org-mode, love it. I've been trying to set up the mac to export anything to pdf. No easy way yet. First there's org-export-as-pdf which first exports to pdf then generates a pdf. I get "pdflatex: command not found", fair enough... stumped. Other option is org-export-as-docbook-pdf which exports as DocBook XML then pdf. In this case I get "XSLT processor command is not set correctly".

In both cases the .tex and .xml files are generated. In both cases I get through enough reading to think: "there must be an easier way", and here I am. Thanks.

Mac OS X 10.6.7 Emacs.app 23.2.1 Org-mode 7.4

5

5 Answers

6
votes

I stumbled into this error today after upgrading to OS X Lion recently.

The reason you get the pdflatex: command not found error message is because Emacs is not including the texlive binaries into its PATH, so you have to add them manually.

So, after having downloaded and install the most recent version of the Texlive distribution for OS X from here, something like these lines should solve the error:

(if (eq window-system 'mac)
   (add-to-list 'exec-path "/usr/local/texlive/2011/bin/universal-darwin")
)
2
votes

I think the short answer is that you'll need to install either of the missing tools. In my case, I use LaTeX extensively, so I have TeX Live installed. That will give you pdflatex which will let org-export-as-pdf work properly. However, TeX is a huge system (several hundred megabytes to download), so if your only need for it is org-mode, you might rather install a docbook processor.

I'm not an expert on org-mode, so maybe there's a way around it. You could generate HTML and convert that to PDF using the method of your choice, but I'm guessing the optimum path is to install one of the processors needed.

1
votes

In order to export an org-mode file to pdf (xslt+fo) in osx:

  • Install docbook stylesheets, an xslt and a fo processors

$ brew install docbook saxon fop

  • Set variables as specified by org-mode documentation, and your processors' documentation:

(require 'org-docbook) ;; (setq org-export-docbook-xsl-fo-proc-command "/usr/local/bin/fop \"%i\" \"%o\"") (setq org-export-docbook-xslt-proc-command "/usr/local/bin/saxon -o:\"%o\" -s:\"%i\" -xsl:\"%s\"") (setq org-export-docbook-xslt-stylesheet "/usr/local/Cellar/docbook/5.0/docbook/xsl-ns/1.77.1/fo/docbook.xsl")

For more up to date information: https://gist.github.com/4534326

1
votes

Easiest way I've found is to install LibreOffice for Mac and then follow the steps below.

Customize the variable org-export-odt-convert-processes and add an entry

Converter Name: LibreOffice
Converter Value: /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to %f%x --outdir %d %i

Customize the variable org-export-odt-convert-process and select "LibreOffice".

Customize the variable org-export-odt-preferred-output-format and select "pdf".

Export your file to OpenDocument format (C-c C-e o) which will now create an Open Document (.odt) file and immediately use the command line converter to create a .pdf file.

0
votes

You can export DocBook XML and then format it to PDF. For DocBook to PDF formatting you will need to install XSLFO processor and DocBook XSL stylesheets (as described in the org-mode manual). Additionally you can use docbookpublishing.com web service for DocBook to PDF formatting.