improve documentations

pull/295/head
Shuhei Kadowaki 2020-03-26 21:41:54 +09:00
parent 7a7d8f3dde
commit 9e9fe45231
3 changed files with 29 additions and 29 deletions

View File

@ -10,29 +10,29 @@ Weave currently supports the following chunk options with the following defaults
## Options for code
* `echo = true`. Echo the code in the output document. If `false` 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. If `false` the chunk wont be executed.
* `term=false`. If `true` the output emulates a REPL session. Otherwise only stdout and figures will be included in output.
* `label`. Chunk label, will be used for figure labels in Latex as fig:label
* `wrap = true`. Wrap long lines from output.
* `line_width = 75`. Line width for wrapped lines.
* `cache = false`. Cache results, depends on `cache` parameter on `weave` function.
* `hold = false`. Hold all results until the end of the chunk.
* `tangle = true`. Set tangle to `false` to exclude chunk from tangled code.
- `echo = true`: Echo the code in the output document. If `false` 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. If `false` the chunk wont be executed.
- `term = false`: If `true` 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 as `fig:label`.
- `wrap = true`: Wrap long lines from output.
- `line_width = 75`: Line width for wrapped lines.
- `cache = false`: Cache results, depending on `cache` parameter on `weave` function.
- `hold = false`: Hold all results until the end of the chunk.
- `tangle = true`: Set tangle to `false` to exclude chunk from tangled code.
## Options for figures
* `fig_width`. Figure width passed to plotting library e.g. `800`
* `fig_height` 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 markup
* `dpi`=96. Resolution of saved figures.
* `fig_cap`. Figure caption.
* `label`. Chunk label, will be used for figure labels in Latex as fig:label
* `fig_ext`. File extension (format) of saved figures.
* `fig_pos="!h"`. Figure position in Latex.
* `fig_env="figure"`. Figure environment in Latex.
- `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 markup
- `dpi = 96`: Resolution of saved figures.
- `fig_cap`: Figure caption.
- `label`: Chunk label, will be used for figure labels in Latex as fig:label
- `fig_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

View File

@ -217,7 +217,7 @@ Convert Weave document `source` to Jupyter notebook and execute the code using `
* `"somepath"`: `String` of output directory e.g. `"~/outdir"`, or of filename e.g. `"~/outdir/outfile.tex"`
- `timeout = -1`: nbconvert cell timeout in seconds. Defaults to `-1` (no timeout)
- `nbconvert_options = ""`: `String` of additional options to pass to nbconvert, such as `"--allow-errors"`
- `jupyter_path = "jupyter"`: Path/command for the Jupyter you want to use. Defaults to "jupyter," which runs whatever is linked/alias to that
- `jupyter_path = "jupyter"`: Path/command for the Jupyter you want to use. Defaults to `"jupyter"`, which runs whatever is linked/alias to that
"""
function notebook(
source::AbstractString;

View File

@ -45,7 +45,7 @@ const rcParams = deepcopy(defaultParams)
Set default options for code chunks, use [`get_chunk_defaults`](@ref) to see the current values.
E.g.: set default `dpi` to 200 and `fig_width` to 8
E.g.: set default `dpi` to `200` and `fig_width` to `8`
```julia
julia> set_chunk_defaults(Dict{Symbol, Any}(:dpi => 200, fig_width => 8))
@ -57,7 +57,7 @@ function set_chunk_defaults(opts::Dict{Symbol, Any})
end
"""
`get_chunk_defaults()`
get_chunk_defaults()
Get default options used for code chunks.
"""
@ -66,9 +66,9 @@ function get_chunk_defaults()
end
"""
`restore_chunk_defaults()`
restore_chunk_defaults()
Restore Weave.jl default chunk options
Restore Weave.jl default chunk options.
"""
function restore_chunk_defaults()
rcParams[:chunk_defaults] = defaultParams[:chunk_defaults]
@ -93,9 +93,9 @@ end
getvalue(d::Dict, key , default) = haskey(d, key) ? d[key] : default
"""
header_args(doc::WeaveDoc)`
header_args(doc::WeaveDoc)
Get weave arguments from document header
Get weave arguments from document header.
"""
function header_args(doc::WeaveDoc, out_path, mod, fig_ext, fig_path,
cache_path, cache, throw_errors,template,
@ -129,9 +129,9 @@ function header_args(doc::WeaveDoc, out_path, mod, fig_ext, fig_path,
end
"""
`header_chunk_defaults!(doc::WeaveDoc)`
header_chunk_defaults!(doc::WeaveDoc)
Get chunk defaults from header and update
Get chunk defaults from header and update.
"""
function header_chunk_defaults!(doc::WeaveDoc)
for key in keys(doc.chunk_defaults)