I'm having this problem: My org file with a source code block, when exporting to PDF the source is not properly exported. Here is the content of the file:
#+TITLE: A Document with Emacs-Lisp Source Code
#+NAME:map_example
#+BEGIN_SRC emacs-lisp :exports code
(setq org-latex-pdf-process '("latexmk -f -pdf %f"))
#+END_SRC
#+RESULTS: map_example
| latexmk -f -pdf %f |
Here is the the generated .tex file:
% Created 2019-08-07 Wed 13:22
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[margin=2cm]{geometry}
\author{Yu (Aaron) Shen}
\date{\today}
\title{A Document with Emacs-Lisp Source Code}
\hypersetup{
pdfauthor={Yu (Aaron) Shen},
pdftitle={A Document with Emacs-Lisp Source Code},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 26.2 (Org mode 9.2.3)},
pdflang={English}}
\begin{document}
\maketitle
\tableofcontents
\lstset{language=Lisp,label=map_example,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}
(setq org-latex-pdf-process '("latexmk -f -pdf %f"))
\end{lstlisting}
\end{document}
Here is the output of Org LaTexOutput:
Latexmk: Run number 1 of rule 'pdflatex'
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
With the generated test.tex from org file by exporting to PDF, and manually execute the following command:
latexmk -f -pdf test.tex
There is a fatal error with the error trace:
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/share/texlive/texmf-dist/tex/latex/wasysym/uwasy.fd)
(/usr/share/texlive/texmf-dist/tex/latex/base/ulasy.fd)
! Undefined control sequence.
l.165 \lstset
{language=Lisp,label=map_example,caption= ,captionpos=b,numbers...
?
I tried to export the same file to HTML, it produces the expected HTML rendering
My emacs/org setup used to work with PDF export of source code.
How can I investigate and fix the problem?
org-latex-pdf-process? - NickD-quietfor now, try it again and check the*Org PDF LaTeX Output*buffer for clues. If it's a LaTeX problem, that should provide some information. But if it's an Org mode problem, then looking at the contents of the .tex file (and adding it to your question if you can't figure out what's going on) is the way to go. - NickDorg-latex-pdf-processsetting. For the source block, you are usinglistingsand since there is no known language called 'dart', it falls back toLispwhich is bizarre. - NickDmintedmethod for dealing with source block formatting. You need to setorg-latex-listingstominted, but you also need to install themintedLaTeX package and thepygmentspackage that it depends on. The doc string fororg-latex-listingshas details. - NickD