mirror of https://github.com/mpastell/Weave.jl
8 lines
6.1 KiB
HTML
8 lines
6.1 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Chunk options · Weave.jl</title><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><h1>Weave.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="../search/"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../">Weave.jl - Scientific Reports Using Julia</a></li><li><a class="toctext" href="../getting_started/">Getting started</a></li><li><a class="toctext" href="../usage/">Using Weave</a></li><li><a class="toctext" href="../publish/">Publishing to html and pdf</a></li><li class="current"><a class="toctext" href>Chunk options</a><ul class="internal"><li><a class="toctext" href="#Options-for-code-1">Options for code</a></li><li><a class="toctext" href="#Options-for-figures-1">Options for figures</a></li><li><a class="toctext" href="#Set-default-chunk-options-1">Set default chunk options</a></li></ul></li><li><a class="toctext" href="../notebooks/">Working with Jupyter notebooks</a></li><li><a class="toctext" href="../function_index/">Function index</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href>Chunk options</a></li></ul><a class="edit-page" href="https://github.com/mpastell/Weave.jl/blob/master/doc/src/chunk_options.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Chunk options</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Chunk-options-1" href="#Chunk-options-1">Chunk options</a></h1><p>I've mostly followed <a href="http://yihui.name/knitr/options">Knitr</a>'s naming for chunk options, but not all options are implemented.</p><p>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:</p><p><code>julia; out_width="12cm"; echo=false</code></p><p>Weave currently supports the following chunk options with the following defaults:</p><h2><a class="nav-anchor" id="Options-for-code-1" href="#Options-for-code-1">Options for code</a></h2><ul><li><code>echo = true</code>. Echo the code in the output document. If <code>false</code> the source code will be hidden.</li><li><code>results = "markup"</code>. 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 wan’t to e.g. create tables from code chunks.</li><li><code>eval = true</code>. Evaluate the code chunk. If false the chunk won’t be executed.</li><li><code>term=false</code>. If true the output emulates a REPL session. Otherwise only stdout and figures will be included in output.</li><li><code>label</code>. Chunk label, will be used for figure labels in Latex as fig:label</li><li><code>wrap = true</code>. Wrap long lines from output.</li><li><code>line_width = 75</code>. Line width for wrapped lines.</li><li><code>cache = false</code>. Cache results, depends on <code>cache</code> parameter on <code>weave</code> function.</li><li><code>hold = false</code>. Hold all results until the end of the chunk.</li><li><code>tangle = true</code>. Set tangle to false to exclude chunk from tangled code.</li></ul><h2><a class="nav-anchor" id="Options-for-figures-1" href="#Options-for-figures-1">Options for figures</a></h2><ul><li><code>fig_width</code>. Figure width passed to plotting library e.g. <code>800</code></li><li><code>fig_height</code> Figure height passed to plotting library</li><li><code>out_width</code>. Width of saved figure in output markup e.g. "50%", "12cm", <code>\\0.5linewidth</code></li><li><code>out_height</code>. Height of saved figure in output markup</li><li><code>dpi</code>=96. Resolution of saved figures.</li><li><code>fig_cap</code>. Figure caption.</li><li><code>label</code>. Chunk label, will be used for figure labels in Latex as fig:label</li><li><code>fig_ext</code>. File extension (format) of saved figures.</li><li><code>fig_pos="htpb"</code>. Figure position in Latex. </li><li><code>fig_env="figure"</code>. Figure environment in Latex.</li></ul><h2><a class="nav-anchor" id="Set-default-chunk-options-1" href="#Set-default-chunk-options-1">Set default chunk options</a></h2><p>You can set the default chunk options (and <code>weave</code> arguments) for a document using the YAML header <code>options</code> field. e.g to set the default <code>out_width</code> of all figures you can use:</p><pre><code class="language-yaml">---
|
||
options:
|
||
out_width : 50%
|
||
---</code></pre><p>You can also set or change the default chunk options for a document either before weave using the <code>set_chunk_defaults function</code>.</p><pre><code class="language-none">set_chunk_defaults(opts)
|
||
get_chunk_defaults()
|
||
restore_chunk_defaults()</code></pre><footer><hr/><a class="previous" href="../publish/"><span class="direction">Previous</span><span class="title">Publishing to html and pdf</span></a><a class="next" href="../notebooks/"><span class="direction">Next</span><span class="title">Working with Jupyter notebooks</span></a></footer></article></body></html>
|