noweb

Unwanted question marks in noweb output


I have the following noweb file, titled test

\documentclass{article}
\usepackage{noweb}
\begin{document}
\section{Hello World}
This is a program

<<example.py>>=
print("Hello, world!")
@
\end{document}

I type the following commands:

pdflatex test.tex
evince test.pdf

The pdf looks something like this:

??    <example.py ??>=
         print("Hello, world!")
      This code is written to file example.py

What are these question marks and how do I get rid of them?


Solution

  • You have to run pdflatex test.tex a second time. The first run generates warnings about undefined cross-references. Those cross-references are defined in the generated aux file, which is then used with the second pass.