Documents in BayesHive contain three different kinds of sections, which are distinguished by the first character(s) in the line: text, code and questions.
This is text > thisIsCode = "this is code" The following line is a question: ?> 2 + 2
Any line in a document that does not start with a
?> is text. You can use text to provide explanations of the code, to introduce the subject; or whatever else you would like to write.
The text is written in markdown which is a lightweight notation for formatting text. Most of what you write (for instance, words or punctuation) will appear directly in the typeset document identically to the markdown notation. In addition, some special characters can be used to format the text:
Section headings start with a
# This is a section ## This is a subsection ### this is a subsubsection
Eqautions can be embedded in LaTeX math format. Equations embedded in a text block can be surrounded by dollar signs (
$), like this:
$sin(x)$ renders as . Stand-alone equations are surrounded by double-dollar signs
$$ f(x) = sin(2x) $$
The beginning of the document can contain a metadata block that is surrounded by lines containing three hyphens (
---) each. This block can contain annotations in the
keyword: value syntax.
Currently supported keywords are
date. These will be typeset with appropriate heading styles.
--- title: On the Origin of Species author: Charles Darwin, M.A., Fellow Of The Royal, Geological, Linnaean, Etc., Societies date: October 1st, 1859 --- # Introduction When on board H.M.S. 'Beagle,' as naturalist, I was much struck with certain facts...
You can add marginalia to your document in a variety of ways:
In a text block, enclose a note1 in
[ ^ (but without the space between
^) at the beginning and
^ ] (again with no space between
if a question resulting in a plot is specified in one or more lines of less than 36 characters each, this code is typeset in the margin.
Not yet implemented
To make a plot appear in the margins, apply the
inMargins combinator to it. It will appear in the margins of the next text block.
?>> inMargins $ distPlot $ normal 0 1
Its is probably not a good idea to mix margin notes and margin plots.
Not yet implemented
Inserting the text
[[TOC]] will generate a table of contents in place.
Lines that start with
> are interpreted as code written in the Baysig language. They must consist of a declaration, a type annotation, a type defintion or a source extraction.
Baysig uses a layout rule for determining when one declaration ends and another one starts. This replaces the brakcets found in many programming languages with an indentation.
This is a function > f x > = x + 1
Please consult the Baysig quick tour and Baysig reference manual for further documentation.
Document sources can contain questions which in the typeset document are augmented with answers. Questions start with
?> and are followed by a Baysig expression which is evaluated to obtain the answer.
Some answers generate special outputs, depending on their types. Lists of records are typeset as tables and Plot values are replaced by plots of the underlying data.