summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-10-10 20:24:32 +0000
committerKarl Berry <karl@freefriends.org>2023-10-10 20:24:32 +0000
commit60edacb591380fc24ec38250489e8999f91b566f (patch)
tree0da56eb48ad1f7e665f6214e5f807d92bb9d7e41 /Master/texmf-dist
parentb3cd1cdbf5aba4dcabafc0ba9a14d6338229b475 (diff)
tkz-bernoulli (10oct23)
git-svn-id: svn://tug.org/texlive/trunk@68503 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdfbin182354 -> 188693 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex68
-rw-r--r--Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty91
3 files changed, 151 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf
index c4fb7fd8e24..dd6c2d04072 100644
--- a/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf
+++ b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex
index ea284f43501..56a57312d04 100644
--- a/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex
+++ b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex
@@ -34,8 +34,8 @@
\hypersetup{pdfborder=0 0 0}
\usepackage[margin=1.5cm]{geometry}
\setlength{\parindent}{0pt}
-\def\TPversion{0.1.0}
-\def\TPdate{9 septembre 2023}
+\def\TPversion{0.1.1}
+\def\TPdate{10 octobre 2023}
\usepackage{tcolorbox}
\tcbuselibrary{skins,hooks}
\usepackage{soul}
@@ -308,6 +308,40 @@ Les \textsf{clés} relatives aux commandes précédentes permettent de modifier
\tkzSchemBernoulli*
\end{demohigh}
+\subsection{La commande pour une épreuve de Bernoulli}
+
+Il existe une commande, \MontreCode{\textbackslash tkzEpreuvBernoulli}, pour afficher un arbre \textit{simple}, avec le même fonctionnement que les arbres \textit{complets}.
+
+Certaines clés n'ont pas d'effet, donc il n'y aura pas de d'explications dédiées pour cette commande.
+
+\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+%commande dans un environnement tikzpicture
+\begin{tikzpicture}
+ \tkzEpreuvBernoulli[clés]
+\end{tikzpicture}
+\end{codehigh}
+
+\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+\begin{tikzpicture}
+ \tkzEpreuvBernoulli
+\end{tikzpicture}
+~~
+\begin{tikzpicture}
+ \tkzEpreuvBernoulli[Racine=false]
+\end{tikzpicture}
+\end{demohigh}
+
+\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+%commande autonome
+\tkzEpreuvBernoulli*[clés]
+\end{codehigh}
+
+\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+\tkzEpreuvBernoulli*[Probas={$p$/$q$}]
+~~
+\tkzEpreuvBernoulli*
+\end{demohigh}
+
\pagebreak
\section{English commands}
@@ -354,6 +388,34 @@ Default styles are given by :
\tkzBernTreeStyleDefault
\end{codehigh}
+\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+%command in an environment tikzpicture for a single Bernoulli trial
+\begin{tikzpicture}
+ tkzBernoulliTrial[keys]
+\end{tikzpicture}
+\end{codehigh}
+
+\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+\begin{tikzpicture}
+ \tkzBernoulliTrial
+\end{tikzpicture}
+~~
+\begin{tikzpicture}
+ \tkzBernoulliTrial[Root=false]
+\end{tikzpicture}
+\end{demohigh}
+
+\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+%stand-alone command for a single Bernoulli trial
+\tkzBernoulliTrial*[keys]
+\end{codehigh}
+
+\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
+\tkzBernoulliTrial*[Probs={$p$/$q$}]
+~~
+\tkzBernoulliTrial*
+\end{demohigh}
+
\subsection{Examples}
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
@@ -363,7 +425,7 @@ Default styles are given by :
\end{demohigh}
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
-\tkzBernoulliTree*[Help,ShowProbs=false,LevelSep=3.25,NodeSep=0.75,N=4,Guide,var=Z]
+\tkzBernoulliTree*[Help,ShowProbs=false,LevelSep=3.25,NodeSep=0.75,N=4,Guide,Var=Z]
\end{demohigh}
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10]
diff --git a/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty b/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty
index 88e3ebaed46..5398bbbb0c9 100644
--- a/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty
+++ b/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty
@@ -2,9 +2,10 @@
% licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tkz-bernoulli}[2023/09/09 0.1.0 Draw Bernoulli tree with tikz]
+\ProvidesPackage{tkz-bernoulli}[2023/10/10 0.1.1 Draw Bernoulli tree with tikz]
%====HISTORIQUE
+% v 0.1.1 Correction de bugs + ajout d'une commande pour une épreuve de Bernoulli
% v 0.1.0 Version initiale [fr] et [en]
%====BASE
@@ -83,6 +84,45 @@
N=3
}
+\NewDocumentCommand\tkzEpreuvBernoulli{ s O{} D<>{} }{%
+ \useKVdefault[ArbreBernoulli]%
+ \setKV[ArbreBernoulli]{#2}%
+ \saveexpandmode\expandarg
+ \StrCut{\ArBinEvts}{/}{\ArBinSucces}{\ArBinEchec}%
+ \StrCut{\ArBinProbas}{/}{\ArBinProbSucces}{\ArBinProbEchec}%
+ \restoreexpandmode
+ \IfBooleanT{#1}%
+ {%
+ \begin{tikzpicture}[#3]
+ }%
+ \IfStrEq{\ArBinRacine}{false}%
+ {%
+ \coordinate (A0-1) at (0,0) ;%
+ \coordinate (B0-1) at (0,0) ;%
+ }%
+ {%
+ \coordinate (A0-1) at (0,0) ;%
+ \node[BernRacine] (B0-1) at (A0-1) {\ArBinRacine} ;%
+ }%
+ \coordinate (A1-1) at ($(A0-1)+({\ArBinIN},{0.5*\ArBinIF})$) ;
+ \coordinate (A1-2) at ($(A0-1)+({\ArBinIN},{-0.5*\ArBinIF})$) ;
+ \node[BernNoeudS] (B1-1) at (A1-1) {\ArBinSucces} ;%succès
+ \node[BernNoeudE] (B1-2) at (A1-2) {\ArBinEchec} ;%échec
+ \ifboolKV[ArbreBernoulli]{AffProbas}%
+ {%
+ \draw[BernBranche] (B0-1) -- (B1-1) node[BernProbaS] {\ArBinProbSucces} ;
+ \draw[BernBranche] (B0-1) -- (B1-2) node[BernProbaE] {\ArBinProbEchec} ;
+ }%
+ {%
+ \draw[BernBranche] (B0-1) -- (B1-1) ;
+ \draw[BernBranche] (B0-1) -- (B1-2) ;
+ }%
+ \IfBooleanT{#1}%
+ {%
+ \end{tikzpicture}%
+ }%
+}
+
\NewDocumentCommand\tkzSchemBernoulli{ s O{} D<>{} }{%
\useKVdefault[ArbreBernoulli]%
\setKV[ArbreBernoulli]{#2}%
@@ -104,6 +144,7 @@
%Racine
\IfStrEq{\ArBinRacine}{false}%
{%
+ \coordinate (A0-1) at (0,0) ;%
\coordinate (B0-1) at (0,0) ;%
}%
{%
@@ -160,7 +201,7 @@
\foreach \i in {1,...,\fpeval{2**\ArBinN}}{%
\def\itmp{\fpeval{2**\ArBinN-\i}}%
\def\ArBenTmpBin{\xintDecToBin{\itmp}}%
- \draw (B\ArBinN-\i) node[BernNotice] {$\longrightarrow X=\StrCount{\ArBenTmpBin}{1}$} ;
+ \draw (B\ArBinN-\i) node[BernNotice] {$\longrightarrow \ArBinVar=\StrCount{\ArBenTmpBin}{1}$} ;
}%
}%
{}%
@@ -227,7 +268,7 @@
\setKVdefault[BernoulliTree]{%
LevelSep=2.25,%
NodeSep=1,%
- Events={$S$/$E$},%
+ Events={$S$/$F$},%
Probs={$p$/$1-p$},%
Grid=false,%
ShowProbs=true,%
@@ -238,6 +279,45 @@
N=3
}
+\NewDocumentCommand\tkzBernoulliTrial{ s O{} D<>{} }{%
+ \useKVdefault[BernoulliTree]%
+ \setKV[BernoulliTree]{#2}%
+ \saveexpandmode\expandarg
+ \StrCut{\ArBinEvts}{/}{\ArBinSucces}{\ArBinEchec}%
+ \StrCut{\ArBinProbas}{/}{\ArBinProbSucces}{\ArBinProbEchec}%
+ \restoreexpandmode
+ \IfBooleanT{#1}%
+ {%
+ \begin{tikzpicture}[#3]
+ }%
+ \IfStrEq{\ArBinRacine}{false}%
+ {%
+ \coordinate (A0-1) at (0,0) ;%
+ \coordinate (B0-1) at (0,0) ;%
+ }%
+ {%
+ \coordinate (A0-1) at (0,0) ;%
+ \node[BernRoot] (B0-1) at (A0-1) {\ArBinRacine} ;%
+ }%
+ \coordinate (A1-1) at ($(A0-1)+({\ArBinIN},{0.5*\ArBinIF})$) ;
+ \coordinate (A1-2) at ($(A0-1)+({\ArBinIN},{-0.5*\ArBinIF})$) ;
+ \node[BernNodeS] (B1-1) at (A1-1) {\ArBinSucces} ;%succès
+ \node[BernNodeF] (B1-2) at (A1-2) {\ArBinEchec} ;%échec
+ \ifboolKV[BernoulliTree]{ShowProbs}%
+ {%
+ \draw[BernEdge] (B0-1) -- (B1-1) node[BernProbS] {\ArBinProbSucces} ;
+ \draw[BernEdge] (B0-1) -- (B1-2) node[BernProbF] {\ArBinProbEchec} ;
+ }%
+ {%
+ \draw[BernEdge] (B0-1) -- (B1-1) ;
+ \draw[BernEdge] (B0-1) -- (B1-2) ;
+ }%
+ \IfBooleanT{#1}%
+ {%
+ \end{tikzpicture}%
+ }%
+}
+
\NewDocumentCommand\tkzBernoulliTree{ s O{} D<>{} }{%
\useKVdefault[BernoulliTree]%
\setKV[BernoulliTree]{#2}%
@@ -259,6 +339,7 @@
%Racine
\IfStrEq{\ArBinRacine}{false}%
{%
+ \coordinate (A0-1) at (0,0) ;%
\coordinate (B0-1) at (0,0) ;%
}%
{%
@@ -267,7 +348,7 @@
}%
%Aide Racine
\ifboolKV[BernoulliTree]{Help}%
- {\draw[teal] (B0-1) node[below=4pt,font=\tiny\ttfamily] {A00} ;}%
+ {\draw[teal] (B0-1) node[below=4pt,font=\tiny\ttfamily] {B0-1} ;}%
{}%
%générations des nœuds du premier chemin
\foreach \i in {1,...,\ArBinN}{%
@@ -315,7 +396,7 @@
\foreach \i in {1,...,\fpeval{2**\ArBinN}}{%
\def\itmp{\fpeval{2**\ArBinN-\i}}%
\def\ArBenTmpBin{\xintDecToBin{\itmp}}%
- \draw (B\ArBinN-\i) node[BernGuide] {$\longrightarrow X=\StrCount{\ArBenTmpBin}{1}$} ;
+ \draw (B\ArBinN-\i) node[BernGuide] {$\longrightarrow \ArBinVar=\StrCount{\ArBenTmpBin}{1}$} ;
}%
}%
{}%