Pweave example gallery¶
Basic document: FIR filter design¶
This example demonstrates most basic chunk options, output and capturing figures and it is available in several formats.
Format  Source  Pweaved  HTML  

texpygments  FIR_design_pygments.texw 
open 
open 

tex  FIR_design_verb.texw 
open 
open 

texminted  FIR_design_minted.texw 
open 
open 

rst  FIR_design.rstw 
open 
open 

script  FIR_design.py 
open 
open 

pandoc  FIR_design.mdw 
open 
open 
The commands used to process the examples from command line are shown below.
Latex¶
Pweave has several options for LaTeX output, here is a demonstation of differences:
Latex with pygments syntax highlighting:¶
FIR_design_pygments.texw
, FIR_design_pygments.tex
, FIR_design_pygments.pdf
and with IPython shell FIR_design_pygments_ipy.pdf
.
Notice that the first command creates the needed pygments.sty
.
See pygments docs for more info.
pygmentize f tex S default > pygments.sty
pweave f texpygments FIR_design_pygments.texw
pdflatex FIR_design_pygments.tex
pweave s ipython f texpygments FIR_design_pygments.texw
cp FIR_design_pygments.tex FIR_design_pygments_ipy.tex
pdflatex FIR_design_pygments_ipy.tex
Latex with verbatim output:¶
FIR_design_verb.texw
, FIR_design_verb.tex
, FIR_design_verb.pdf
.
pweave f tex FIR_design_verb.texw
pdflatex FIR_design_verb.tex
Latex with Minted package for syntax highlighting:¶
FIR_design_minted.texw
, FIR_design_minted.tex
, FIR_design_minted.pdf
.
pweave f texminted FIR_design_minted.texw
pdflatex shellescape FIR_design_minted.tex
Note
Using pygments directly from Pweave is much faster than using Minted separately.
reStructuredText¶
FIR_design.rstw
, FIR_design.rst
, FIR_design_rst.html
.
pweave FIR_design.rstw
rst2html.py FIR_design.rst FIR_design_rst.html
Published from script¶
You can publish documents directly using the pypublish command.
Using doxygen mark up:
FIR_design.py
, FIR_design.html
, FIR_design.pdf
.
Using cell mark up:
FIR_design_cells.py
, FIR_design_cells.html
, FIR_design_cells.pdf
.
pypublish FIR_design.py
pypublish FIR_design_cells.py
pypublish f pdf FIR_design.py
pypublish f pdf FIR_design_cells.py
Markdown¶
Pandoc¶
FIR_design.mdw
, FIR_design.md
, FIR_design_pandoc.html
pweave f pandoc FIR_design.mdw
pandoc s mathjax FIR_design.md o FIR_design_pandoc.html
Pythonmarkdown¶
md2html and pandoc2latex formats produce output that is identical to pypublish command.
FIR_design.mdw
, FIR_design.html
Pweave f md2html FIR_design_noweb.mdw
Splitting code to multiple chunks¶
This example shows how to split code between multiple chunks to write documentation within a class using complete chunk option.
AR_yw.mdw
, AR_yw.html
, AR_yw.pdf
.
pweave f md2html AR_yw.mdw
pweave f pandoc2latex AR_yw.mdw
pdflatex AR_yw.tex
Octave and Matlab¶
Pweave also supports weaving Octave/Matlab documents similar to Python. The support is more limited, but it is still useful. See the example below for more info.
octave_sample.mdw
, octave_sample.md
, octave_sample.pdf
.
pweave s octave f pandoc octave_sample.mdw
pandoc octave_sample.md o octave_sample.pdf
If you have Matlab and “pythonmatlabbrigde” installed you can use s matlab option.
New in version 0.23.
Miscellaneous¶
Linear regression with Statsmodels: linear_regression.py
, linear_regression.html
pypublish linear_regression.py
About the gallery¶
This page is an executable document that be run using Pweave using IPython shell to run all examples using:
pweave index.rstw
The latest version of the examples with any required extra files are available from the Git repository in examples directory.
This gallery was created using:
>>> import pweave
>>> pweave.__version__
u'0.25'
>>> import sys
>>> print(sys.version)
2.7.11 Continuum Analytics, Inc. (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.71)]