0

I am trying to use org-mode export through LaTex to get a nice PDF of my documents, but I can't get it to show highlighted code blocks through Pygments. The following is a snapshot of my configuration.

  (setq org-latex-pdf-process
        '("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
          "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
          "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

  (setq TeX-parse-self t)


  (setq latex-run-command "pdflatex")
  (setq TeX-PDF-mode t)

  (add-to-list 'org-latex-packages-alist '("" "minted"))
  (setq org-latex-listings 'minted)

  (setq org-latex-inputenc-alist '(("utf8" . "utf8x")))

Is there anything missing here? It works nicely through the command line (although that one does not generate the table of contents, but that's another matter).

Everything is installed properly, and Emacs terminals do recognize all commands.

Edit: Things I have tried

  1. Substitute the xlatex command with pdflatex. No effect.
  2. Reduce the above series of command line calls to just one instead of three.

Simple output comes off like this:

p(n+nvaddhook l+s+ssgomodehook
          p(klambda p()
JavaScript
p(n+nbset p(n+nvmakelocalvariable l+s+sscompanybackendsp)
     op(n+nvcompanygop))
p(n+nvcompanymodep)
p(kif p(n+nbnot p(n+nvstringmatch l+sgo n+nvcompilecommandp))
    p(n+nbset p(n+nvmakelocalvariable l+s+sscompilecommandp)
         l+sgo build v  go test v  go vetp))
p(n+nvflycheckmodep)))
  • What does "simple output comes off like this:" refer to? Is this the content of the generated PDF, or something produced in an Emacs buffer, or ? Can you provide a short org file that demonstrates the problem you are having with export? – Tyler Apr 23 at 15:27
  • That refers to the PDF output. And example org file would be to simply wrap my code above with emacs-elisp code blocks then C-c C-e l o. – n_x_l Apr 23 at 17:39
0

I can't reproduce your problem. I made a small example org-mode file:

Here's the code used to configure Emacs:

#+begin_src elisp 
  (setq org-latex-pdf-process
    '( "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
    "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
    "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

  (add-to-list 'org-latex-packages-alist '("" "minted"))
  (setq org-latex-listings 'minted)
  (setq org-latex-inputenc-alist '(("utf8" . "utf8x")))
#+end_src 

#+RESULTS:
: ((utf8 . utf8x))

And the original code example from the question:

#+begin_src elisp
p(n+nvaddhook l+s+ssgomodehook
          p(klambda p()
JavaScript
p(n+nbset p(n+nvmakelocalvariable l+s+sscompanybackendsp)
     op(n+nvcompanygop))
p(n+nvcompanymodep)
p(kif p(n+nbnot p(n+nvstringmatch l+sgo n+nvcompilecommandp))
    p(n+nbset p(n+nvmakelocalvariable l+s+sscompilecommandp)
         l+sgo build v  go test v  go vetp))
p(n+nvflycheckmodep)))
#+end_src

I started Emacs with emacs -Q to bypass my own config, and executed the first source block with C-c C-c to set the export options. I left out the options for AucTeX, as they shouldn't have any effect on orgmode exports. Then I compiled with C-c C-e l o. The result looks like this:

enter image description here

The first code block is highlighted as I would expect. The second code block isn't really highlighted, but it isn't really elisp either, so I'm not sure what you expect it to look like?

  • The second code block was what was generated from another code block that I didn't show you. It was also simple Emacs lisp. It's weird that it is working for you, perhaps I am doing some other latex stuff that messes up the config, but I see no warnings. Crucially, it woks when I run the same shell commands on the .tex file generated by Emacs during export, so it's clearly somethign within Emacs that is not passing the right export command or is missing some package linking. I have to dig deeper. – n_x_l Apr 23 at 22:28

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.