texlive[68503] Master/texmf-dist: tkz-bernoulli (10oct23)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 10 22:24:32 CEST 2023


Revision: 68503
          https://tug.org/svn/texlive?view=revision&revision=68503
Author:   karl
Date:     2023-10-10 22:24:32 +0200 (Tue, 10 Oct 2023)
Log Message:
-----------
tkz-bernoulli (10oct23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf
    trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex
    trunk/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty

Modified: trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex	2023-10-10 20:24:20 UTC (rev 68502)
+++ trunk/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex	2023-10-10 20:24:32 UTC (rev 68503)
@@ -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 @@
 \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 @@
 \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 @@
 \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]

Modified: trunk/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty	2023-10-10 20:24:20 UTC (rev 68502)
+++ trunk/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty	2023-10-10 20:24:32 UTC (rev 68503)
@@ -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}$} ;
 				}%
 		}%
 		{}%



More information about the tex-live-commits mailing list.