1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
========================
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.
.. csv-table:: Example in different formats.
:header: "Format", "Source", "Pweaved", "HTML", "PDF"
:widths: 7, 11, 5, 5, 5
md2html, :download:`FIR_designp.pmd <FIR_designp.pmd>` , ,:download:`open <FIR_designp.html>`,
texpygments, :download:`FIR_design_pygments.texw <FIR_design_pygments.texw>` , :download:`open <FIR_design_pygments.tex>` , , :download:`open <FIR_design_pygments.pdf>`
tex, :download:`FIR_design_verb.texw <FIR_design_verb.texw>`, :download:`open <FIR_design_verb.tex>`, , :download:`open <FIR_design_verb.pdf>`
texminted, :download:`FIR_design_minted.texw <FIR_design_minted.texw>`, :download:`open <FIR_design_minted.tex>`, ,:download:`open <FIR_design_minted.pdf>`
rst, :download:`FIR_design.rstw <FIR_design.rstw>`, :download:`open <FIR_design.rst>`, :download:`open <FIR_design_rst.html>`,
script, :download:`FIR_design.py <FIR_design.py>`, , :download:`open <FIR_design.html>`, :download:`open <FIR_design.pdf>`
pandoc, :download:`FIR_designp.pmd <FIR_designp.pmd>`, :download:`open <FIR_designp.md>` , :download:`open <FIR_design_pandoc.html>`,
The commands used to process the examples from command line are shown below.
Markdown
========
HTML output
~~~~~~~~~~~
`md2html` and `pandoc2html` formats produce output that is identical
to pypublish command.
:download:`FIR_designp.pmd <FIR_designp.pmd>`, :download:`FIR_designp.html <FIR_designp.html>`
<<results="hidden">>=
%%bash
pweave -f md2html FIR_designp.pmd
@
To pandoc markdown
~~~~~~~~~~~~~~~~~~
:download:`FIR_designp.pmd <FIR_designp.pmd>`, :download:`FIR_designp.md <FIR_designp.md>` , :download:`FIR_design_pandoc.html <FIR_design_pandoc.html>`
<<results="hidden">>=
%%bash
pweave -f pandoc FIR_designp.pmd
pandoc -s --mathjax FIR_designp.md -o FIR_design_pandoc.html
@
Latex
=====
Pweave has several options for LaTeX output, here is a demonstation of differences:
Latex with pygments syntax highlighting:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:download:`FIR_design_pygments.texw <FIR_design_pygments.texw>`, :download:`FIR_design_pygments.tex <FIR_design_pygments.tex>`, :download:`FIR_design_pygments.pdf <FIR_design_pygments.pdf>`
and with IPython shell :download:`FIR_design_pygments_ipy.pdf <FIR_design_pygments_ipy.pdf>`.
Notice that the first command creates the needed :download:`pygments.sty <pygments.sty>`.
See `pygments docs <http://pygments.org/docs/cmdline/#generating-styles>`__ for more info.
<<results="hidden">>=
%%bash
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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:download:`FIR_design_verb.texw <FIR_design_verb.texw>`, :download:`FIR_design_verb.tex <FIR_design_verb.tex>`, :download:`FIR_design_verb.pdf <FIR_design_verb.pdf>`.
<<results="hidden">>=
%%bash
pweave -f tex FIR_design_verb.texw
pdflatex FIR_design_verb.tex
@
Latex with Minted package for syntax highlighting:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:download:`FIR_design_minted.texw <FIR_design_minted.texw>`, :download:`FIR_design_minted.tex <FIR_design_minted.tex>` , :download:`FIR_design_minted.pdf <FIR_design_minted.pdf>` .
<<results="hidden">>=
%%bash
pweave -f texminted FIR_design_minted.texw
pdflatex -shell-escape FIR_design_minted.tex
@
.. note::
Using pygments directly from Pweave is much faster than
using Minted separately.
reStructuredText
================
:download:`FIR_design.rstw <FIR_design.rstw>`, :download:`FIR_design.rst <FIR_design.rst>` , :download:`FIR_design_rst.html <FIR_design_rst.html>`.
<<rst, results="hidden">>=
%%bash
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:
:download:`FIR_design.py <FIR_design.py>`, :download:`FIR_design.html <FIR_design.html>` , :download:`FIR_design.pdf <FIR_design.pdf>` .
Using cell mark up:
:download:`FIR_design_cells.py <FIR_design.py>`, :download:`FIR_design_cells.html <FIR_design_cells.html>` , :download:`FIR_design_cells.pdf <FIR_design_cells.pdf>` .
<<results="hidden">>=
%%bash
pypublish FIR_design.py
pypublish FIR_design_cells.py
pypublish -f pdf FIR_design.py
pypublish -f pdf FIR_design_cells.py
@
.. _multi-chunk-example:
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.
:download:`AR_yw.mdw <AR_yw.mdw>` , :download:`AR_yw.html <AR_yw.html>` , :download:`AR_yw.pdf <AR_yw.pdf>` .
<<results="hidden">>=
%%bash
pweave -f md2html AR_yw.mdw
pweave -f pandoc2latex AR_yw.mdw
pdflatex AR_yw.tex
@
Miscellaneous
-------------
Linear regression with Statsmodels: :download:`linear_regression.py <linear_regression.py>`, :download:`linear_regression.html <linear_regression.html>`
<<results="hidden">>=
%%bash
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 <http://github.com/mpastell/pweave-docs/>`__
repository in examples directory.
This gallery was created using:
<<term=True, results="verbatim">>=
import pweave
pweave.__version__
import sys
print(sys.version)
@
|