Chunk options
I've mostly followed Knitr's naming for chunk options, but not all options are implemented.
Options are separated using ";" and need to be valid Julia expressions. Example: markdown code chunk that saves and displays a 12 cm wide image and hides the source code:
julia; out_width="12cm"; echo=false
Weave currently supports the following chunk options with the following defaults:
Options for code
echo = true
: Echo the code in the output document. Iffalse
the source code will be hidden.results = "markup"
: The output format of the printed results."markup"
for literal block,"hidden"
for hidden results, or anything else for raw output (I tend to use"tex"
for Latex and"rst"
for rest). Raw output is useful if you want to e.g. create tables from code chunks.eval = true
: Evaluate the code chunk. Iffalse
the chunk won’t be executed.term = false
: Iftrue
the output emulates a REPL session. Otherwise only stdout and figures will be included in output.label = nothing
: Chunk label, will be used for figure labels in Latex asfig:label
.wrap = true
: Wrap long lines from output.line_width = 75
: Line width for wrapped lines.cache = false
: Cache results, depending oncache
parameter onweave
function.hold = false
: Hold all results until the end of the chunk.tangle = true
: Set tangle tofalse
to exclude chunk from tangled code.
Options for figures
fig_width = 6
: Figure width passed to plotting library.fig_height = 4
: Figure height passed to plotting library.out_width
: Width of saved figure in output markup e.g."50%"
,"12cm"
,0.5\linewidth
out_height
: Height of saved figure in output markupdpi = 96
: Resolution of saved figures.fig_cap
: Figure caption.label
: Chunk label, will be used for figure labels in Latex as fig:labelfig_ext
: File extension (format) of saved figures.fig_pos = "!h"
: Figure position in Latex, e.g.:"ht"
.fig_env = "figure"
: Figure environment in Latex.
Set default chunk options
You can set the default chunk options (and weave
arguments) for a document using the YAML header options
field. E.g. to set the default out_width
of all figures you can use:
---
options:
out_width : 50%
----
You can also set or change the default chunk options for a document either before weave using the set_chunk_defaults
function.
Missing docstring for set_chunk_defaults
. Check Documenter's build log for details.
Weave.get_chunk_defaults
— Functionget_chunk_defaults()
Get default options used for code chunks.
Missing docstring for restore_chunk_defaults
. Check Documenter's build log for details.