summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r--Master/texmf-dist/doc/metapost/mptrees/README.md4
-rw-r--r--Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.pdfbin429600 -> 168458 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.tex131
3 files changed, 115 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/metapost/mptrees/README.md b/Master/texmf-dist/doc/metapost/mptrees/README.md
index ee9e901ceab..e439a51d1fd 100644
--- a/Master/texmf-dist/doc/metapost/mptrees/README.md
+++ b/Master/texmf-dist/doc/metapost/mptrees/README.md
@@ -1,7 +1,7 @@
-Package mptrees - Version 17.06 - June 1, 2017
+Package mptrees - Version 21.10 - November 2, 2021
This package provides MetaPost tools for drawing simple probability trees.
-One command and several parameters to control the output are provided.
+One main command, some variants and several parameters to control the output are provided.
License LPPL 1.3
diff --git a/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.pdf b/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.pdf
index 816b302304c..1c9ba9fe38d 100644
--- a/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.pdf
+++ b/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.tex b/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.tex
index e1a2387913a..f83d2b81488 100644
--- a/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.tex
+++ b/Master/texmf-dist/doc/metapost/mptrees/mptrees-doc.tex
@@ -424,7 +424,7 @@ It can be used inside the first set of parameters of the tree (see example below
\end{exemplev}
-\item[abscoord] With the boolean \verb|abscoord| set to \verb|true|, all the coordinates are given from the origin of the \emph{first} tree instead of the origin of the subtree, which make easier the alignment of all the subtrees.
+\item[abscoord] With the boolean \verb|abscoord| set to \verb|true|, all the coordinates are given from the origin of the \emph{first} tree instead of the origin of the subtree, which makes easier the alignment of all the subtrees.
\end{description}
@@ -448,33 +448,40 @@ abscoord:=false;
\section{Parameters}
-\begin{description}
-
-\item[scaleprob] numeric controlling the scale of the label above the edge (the probability). Default is $0.85$.
+\subsection{Event}
+\begin{description}
+\item[scaleev] numeric controlling the scale of the label at the end of the edge (the event). Default is $1$.
\begin{exemple}[0.65]
- scaleprob:=1.5;
+ scaleev:=2;
draw tree[1][1](3cm,2cm)("$A$","$p$","$B$","$q$");
\end{exemple}
\begin{codecache}
-scaleprob:=0.85;
+scaleev:=1;
\end{codecache}
-\item[scaleev] numeric controlling the scale of the label at the end of the edge (the event). Default is $1$.
+\end{description}
+
+\subsection{Probability}
+\begin{description}
+
+
+\item[scaleprob] numeric controlling the scale of the label above the edge (the probability). Default is $0.85$.
\begin{exemple}[0.65]
- scaleev:=2;
+ scaleprob:=1.5;
draw tree[1][1](3cm,2cm)("$A$","$p$","$B$","$q$");
\end{exemple}
\begin{codecache}
-scaleev:=1;
+scaleprob:=0.85;
\end{codecache}
+
\item[posprob] numeric controlling the position of the label above the edge. Default is $0.6$.
@@ -526,6 +533,30 @@ typeprob:=1;
proboffset:=3bp;
\end{codecache}
+\end{description}
+
+\subsection{Edge}
+\begin{description}
+\item[endedgeshift] vertical space added at the end of the edge. Default is $0$. Useful when various edges end at the same point
+
+\begin{exemple}[0.65]
+ draw startlabel("$S$");
+ draw tree[1][1]((3cm,-1cm))("$A$","$p$");
+\end{exemple}
+
+
+\begin{exemple}[0.65]
+ endedgeshift:=10;
+ draw startlabel("$S$");
+ draw tree[1][1]((3cm,-1cm))("$A$","$p$");
+\end{exemple}
+
+\begin{codecache}
+endedgeshift:=0;
+\end{codecache}
+
+
+
\item[edgearrow] When the boolean \verb|edgearrow| is set to true, edges end with an arrow. Default is \verb|false|.
\begin{exemple}[0.65]
@@ -537,26 +568,87 @@ proboffset:=3bp;
edgearrow:=false;
\end{codecache}
-\item[endedgeshift] vertical space added at the end of the edge. Default is $0$. Useful when various edges end at the same point
+\item[branchtype] string which controls the shape of the edge. Possible values are \verb|segment| (default), \verb|curve|, \verb|broken|. With the last one, the length of the first segment of the broken line depends on a numeric parameter, \verb|brokenlineratio| which indicates the ratio between the length of this segment and the length of the horizontal space. Default value is \verb|0.2|.
+\end{description}
\begin{exemple}[0.65]
- draw startlabel("$S$");
- draw tree[1][1]((3cm,-1cm))("$A$","$p$");
+ branchtype:="curve";
+ draw tree[1][1](3cm,3cm)("$A$","$p$","$B$","$q$");
\end{exemple}
+\begin{exemple}[0.65]
+ branchtype:="broken";
+ draw tree[1][1](3cm,3cm)("$A$","$p$","$B$","$q$");
+\end{exemple}
\begin{exemple}[0.65]
- endedgeshift:=10;
- draw startlabel("$S$");
- draw tree[1][1]((3cm,-1cm))("$A$","$p$");
+ branchtype:="broken";
+ posprob:=0.8;
+ brokenlineratio:=0.5;
+ draw tree[1][1](3cm,3cm)("$A$","$p$","$B$","$q$");
+\end{exemple}
+
+
+\begin{exemple}[0.65]
+ branchtype:="broken";
+ posprob:=0.8;
+ brokenlineratio:=0.75;
+ draw tree[1][1](3cm,3cm)("$A$","$p$","$B$","$q$");
\end{exemple}
\begin{codecache}
-endedgeshift:=0;
+ posprob:=0.6;
+ branchtype:="segment";
+ brokenlineratio:=0.2;
\end{codecache}
+\section{Binomial trees}
+
+\begin{description}
+\item[bernoulliprocess(n)(l,h)] tree describing the Bernoulli process with $n$ trials. \verb|l| is the length of the first edges and \verb|h| is the space between two final nodes.
+\item[bernoulliprocessL(n)(L,H)] same as above where \verb|L| is the whole width of the tree and \verb|H| its height.
\end{description}
+Several parameters control the output:
+
+\begin{description}
+\item[bernoullisuccessevent] string printed at every node representing a success. Default is \verb|"$S$"|.
+\item[bernoullifailureevent] string printed at every node representing a failure. Default is \verb|"$\overline{S}$"|.
+\item[bernoullisuccessprob] string printed above every edge representing a success. Default is \verb|"$p$"|.
+\item[bernoullifailureprob] string printed above every edge representing a success. Default is \verb|"$q$"|.
+\item[bernoulliscalebranch] ratio between width of consecutive edges. Default is \verb|0.8|.
+\end{description}
+
+\begin{exemple}[0.45]
+draw bernoulliprocess(3)(3cm,0.7cm);
+\end{exemple}
+
+\begin{exemple}[0.45]
+typeprob:=4;
+bernoullisuccessevent:="$A$";
+bernoullifailureevent:="$B$";
+bernoullisuccessprob:="$0.7$";
+bernoullifailureprob:="$0.3$";
+draw bernoulliprocess(3)(3cm,0.7cm);
+\end{exemple}
+
+\begin{codecache}
+typeprob:=1;
+bernoullisuccessevent := "$S$";
+bernoullifailureevent := "$\overline{S}$";
+bernoullisuccessprob := "$p$";
+bernoullifailureprob := "$q$";
+\end{codecache}
+
+\begin{description}
+\item[binomialtree(n)(l,h)] tree describing the binomial distribution with $n$ trials. \verb|l| is the length of the first edges and \verb|h| is the space between two final nodes. It uses \verb|bernoullisuccesprob| and \verb|bernoullifailureprob| but \verb|bernoulliscalebranch| is set to \verb|1|.
+\item[binomialtreeL(n)(L,H)] same as above where \verb|L| is the whole width of the tree and \verb|H| its height.
+\end{description}
+
+\begin{exemplev}{1}
+draw binomialtree(4)(3cm,1.5cm);
+\end{exemplev}
+
\section{Embedded code in \LaTeX{} files}
@@ -649,6 +741,7 @@ endfig;
\begin{exemplev}[0.9]{1}
u:=0.4cm;
+branchtype:="curve";
dirlabel:=90;
abscoord:=true;
endlabelspace:=0.5cm;
@@ -670,18 +763,20 @@ endlabelspace:=1cm;
\begin{exemplev}[0.9]{1}
u:=1cm;
+branchtype:="broken";
dirlabel:=-90;
abscoord:=true;
scaleev:=2;
-label.top(textext("\Large Tree diagram of $(2x+1)(x-1)$"),(0,1cm));
+label.top(textext("\Large Tree diagram of $(2x+1)(x-3)$"),(0,1cm));
draw startlabel("$\times$");
draw tree[1][1]((-2u,-1.5u),(2u,-1.5u))("$+$","","$-$","");
draw tree[2][1]((-3u,-3.5u),(-1u,-3.5u))("$\times$","","$1$","");
-draw tree[2][2]((1u,-3.5u),(3u,-3.5u))("$x$","","$2$","");
+draw tree[2][2]((1u,-3.5u),(3u,-3.5u))("$x$","","$3$","");
draw tree[3][1]((-4u,-5.5u),(-2u,-5.5u))("$2$","","$x$","");
\end{exemplev}
\begin{codecache}
+branchtype:="segment";
dirlabel:=0;
abscoord:=false;
scaleev:=1;