I'm putting together a fairly complex python script with functions that may or may not be called depending on the data that's being analysed.
In pure python, all works well. As soon as I break out of the code block to create a LaTeX section for the results, I get undefined variable errors. Stripping this back to its most simple case:
<<echo=False,complete=False>>=
def getValues(title, start, end):
@
\section{<%= title %>
... more LaTeX code...
<<echo=False,complete=False>>=
return
@
stripping out the pweave code block tags and the LaTeX markup, this works correctly. As soon as I add the markup the \section line returns that title
is undefined when I attempt to pweave the file.
My understanding from the documentation was that the complete=False would combine the code blocks although I get the same error with or without this.
Since I want the output documentation to be dependent on the functions called, how can I achieve this?
I'd be very grateful if anyone can point me to a missed example, but I've been unable to find a way of doing what I need.
This does not work as ˋcomplete=Falseˋ does not apply to inline blocks so ˋtitleˋ is undefined when your code runs. You could generate your Latex output inside python chunks using results="tex" chunk option.