The Python block 1 generates the figure 1
Figure 1: Figure generated by python
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'
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.