These are my notes on exporting a PDF from an org-babel file.
The key sequence to export a PDF from an org file is
C-c C-e l p (c as in… c, e as in export, l as in LaTex, and p as in PDF). My first try produced this error:
! LaTeX Error: File `ulem.sty` not found.
The actual output had
`ulem.sty`ending with an apostrophe (which I can't show here because org either renders the apostrophe as an accent or if I put it in an inline verbatim block it disables the verbatim markup - seems like a bug) but either nikola or org or something else marked the single apostrophe as an error with a red box around it in the output so I changed it to a backtick (
`) to get rid of the box.
Past experience told me that the error indicated I was likely missing a (debian) package./home/athena/.virtualenvs/necromuralist.github.io/bin/python3: No module named virtualfish
apt-cache search ulem
texlive-generic-recommended - TeX Live: Generic recommended packages libextutils-modulemaker-perl - Perl extension to build module from scratch
Since I'm doing something with LaTex, not perl I decided that installing the texlive-generic-recommended package was probably what I should do./home/athena/.virtualenvs/necromuralist.github.io/bin/python3: No module named virtualfish
sudo apt-get install texlive-generic-recommended
C-c C-e l p again and this time it did output a PDF, but there was no syntax-highlighting of the code. Followng this blog post I added this to my
;; export to latex/pdf (require 'ox-latex) ;; syntax-highlighting for pdf's (add-to-list 'org-latex-packages-alist '("" "minted")) (setq org-latex-listings 'minted) (setq org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
Once I re-loaded the
init.el file, the PDF's came out with the syntax highlighting working.
The original post used
pdflatexbut I don't use
mintedcan be found in the
texlive-latex-extraspackage if it isn't already installed. The post also mentions needing
pygmentsbut I didn't need it, possibly because it's a dependency for other python libraries that I've already installed.