Yssybyl Yssybyl - 6 months ago 33
LaTeX Question

Pweave - putting LaTeX output within python functions

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:

def getValues(title, start, end):
\section{<%= title %>
... more LaTeX code...

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
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download