# An archi-minimal test of source blocks labelling, # using only the built-in tools. #+options: tex:t title:nil author:nil date:nil toc:nil #+title: Test of source block exports #+begin_src emacs-lisp :exports none :results none (setq org-latex-pdf-process (list "latexmk -pdf -pdflatex='%latex -interaction=nonstopmode -shell-escape' -bibtex -f %f") org-latex-listings 'minted) (add-to-list 'org-latex-packages-alist '("newfloat" "minted" t)) #+end_src # #+latex_header: \usepackage[newfloat]{minted} # #+latex_header: \usepackage{listings} The Python block [[lst:DoFig]] generates the figure [[fig:DoFig]] #+name: DoFig #+begin_src python :results file :exports none import matplotlib, numpy matplotlib.use('Agg') import matplotlib.pyplot as plt fig=plt.figure(figsize=(4,2)) x=numpy.linspace(-15,15) plt.plot(numpy.sin(x)/x) fig.tight_layout() plt.savefig('Fig2.png') return 'Fig2.png' #+end_src #+RESULTS: DoFig [[file:Fig2.png]] #+name: fig:DoFig #+caption: Figure generated by python #+ATTR_LATEX: :height 2.5in [[file:Fig2.png]] # #+name: fig:DoFig # #+caption: Figure generated by python # #+RESULTS: DoFig # [[file:Fig2.png]] #+name: lst:DoFig #+caption: Python code generating a figure #+begin_src python :eval no :exports code :noweb yes <> #+end_src Problem: whereas the HTML export labels the source listing as "Listing 1" and is correctly refers to 1, the PDF export labels it "Figure 2" (and points to it) *when the default ~verbatim~ method is used.* When one bothers to use ~minted~, the result is correct.