A Pweave input document contains documentation and code separated with special
markup. Pweave supports several input formats for different purposes. All of the
source formats produce identical output for code. You need to tell the input format
to Pweave using -i command line option.

Code chunk starts with a line marked with <<>>= or <<options>>= and end
with line marked with @. The code between the start and end markers
is executed and the output is captured to the output document.

Example: A code chunk that saves and displays a 12 cm wide image
and hides the source code:

Pweave supports evaluating inline code in documentation chunks
using <%%> (code will be evaluated in place) and <%=%>
(result of expression will be printed) tags. Inline code will not
be included in weaved document.

Weaving a Pweave source file produces a document
that contains text and the weaved code together with its
evaluated output. All of the produced figures are placed in the
‘figures/’ folder as a default.

Pweave has documentation mode (invoked with -d) that caches code
and all results from code chunks so you don’t need to rerun the code
when you are only working on documentation. You can cache the results
using the -c option, if there are no cached results then
documentation mode will create the cache on first run. Inline code
chunks will be hidden in documentation mode. Additionally Pweave will
warn you if the code in cached chunks has changed after the last run.

Contains a mixture of documentation and code chunks. Pweave will
evaluate the code and leave the documentation chunks as they
are. The documentation chunks can be written either with reST,Latex
or Pandoc markdown. The source document is processed using
Pweave, which gives us the formatted output document.

Weaved document

Is produced by Pweave from the source document. Contains the
documentation, original code, the captured outputof the code and
optionally captured matplotlib figures.

Source code

Is produced by Pweave from the source document. Contains the source
code extracted from the code chunks.