diff options
author | Karl Berry <karl@freefriends.org> | 2023-09-09 20:08:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-09-09 20:08:38 +0000 |
commit | f587780334435f61739861314435fa1cf4f7be6c (patch) | |
tree | 46acb7de13aab1c6dadca75fe8dbe07031e83623 /Master | |
parent | 230489e8eeb7072a84e8ba4e1095cd60d3c1bc8a (diff) |
tkz-bernoulli (9sep23)
git-svn-id: svn://tug.org/texlive/trunk@68219 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/tkz-bernoulli/README.md | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf | bin | 0 -> 182354 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex | 384 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty | 328 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 4 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/tkz-bernoulli.tlpsrc | 0 |
8 files changed, 723 insertions, 2 deletions
diff --git a/Master/texmf-dist/doc/latex/tkz-bernoulli/README.md b/Master/texmf-dist/doc/latex/tkz-bernoulli/README.md new file mode 100644 index 00000000000..d27766e2d25 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkz-bernoulli/README.md @@ -0,0 +1,7 @@ +tkz-bernoulli is a package to present Bernoulli trees with tikz. +----------------------------------------------------------------------------- +tkz-bernoulli est un package pour représenter un arbre de Bernoulli avec tikz. +----------------------------------------------------------------------------- +Author : Cédric Pierquet +email : cpierquet@outlook.fr +Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
\ No newline at end of file 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 Binary files differnew file mode 100644 index 00000000000..c4fb7fd8e24 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.pdf 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 new file mode 100644 index 00000000000..ea284f43501 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkz-bernoulli/tkz-bernoulli-doc.tex @@ -0,0 +1,384 @@ +% !TeX TXS-program:compile = txs:///lualatex + +\documentclass[french,11pt,a4paper]{article} +%\usepackage[utf8]{inputenc} +%\usepackage[T1]{fontenc} +\usepackage{amsmath,amssymb} +\usepackage{fontspec} +\setmonofont[Scale=MatchLowercase]{Inconsolatazi4} +\usepackage{tkz-bernoulli} +\usepackage{nicefrac} +\usepackage{enumitem} +\usepackage{codehigh} +\usepackage{multicol} +\usepackage{tabularray} +\usepackage{lipsum} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\usepackage{fontawesome5} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +%\rhead{\sffamily\small\affloetalab[Legende]} +\lfoot{\sffamily\small [tkz-bernoulli]} +\cfoot{\sffamily\small - \thepage{} -} +\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} +\usepackage{hologo} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo + +\usepackage{hyperref} +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\usepackage[margin=1.5cm]{geometry} +\setlength{\parindent}{0pt} +\def\TPversion{0.1.0} +\def\TPdate{9 septembre 2023} +\usepackage{tcolorbox} +\tcbuselibrary{skins,hooks} +\usepackage{soul} +\sethlcolor{lightgray!25} +\NewDocumentCommand\MontreCode{ m }{% + \hl{\vphantom{\texttt{pf}}\texttt{#1}}% +} +\usepackage{siunitx} +\sisetup{locale=FR} +\usepackage{babel} + +\begin{document} + +\pagestyle{fancy} + +\thispagestyle{empty} + +\begin{center} + \begin{minipage}{0.88\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{tkz-bernoulli}}\\ + \\ + {\LARGE Présenter, grâce à \MontreCode{tikz},} \\ + {\LARGE des arbres de Bernoulli.} \\ + \\ + {\LARGE $\rhd$ Commandes [fr] ou [en] $\lhd$} \\ + \\ + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{tabular} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\begin{center} + \begin{tabular}{c} + \texttt{Cédric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://github.com/cpierquet/tkz-bernoulli}} \\ + \end{tabular} +\end{center} + +\hrule + +\vfill + +Présenter, avec personnalisations possibles, un arbre de Bernoulli. + +\vfill + +\begin{tcolorbox}[colframe=lightgray,colback=white] +\MontreCode{\textbackslash tkzSchemBernoulli*} + +\hfill\tkzSchemBernoulli*\hfill~ +\end{tcolorbox} + +\vspace*{5mm} + +\begin{tcolorbox}[colframe=lightgray,colback=white] +\MontreCode{\textbackslash tkzSchemBernoulli*} + +\phantom{\texttt{~~~~}}\MontreCode{[N=2,EspNiv=3,EspFeuil=1.25,NoticeProbas=\{\textbackslash num{0.75}/\textbackslash num\{0.25\}\},Evts=\{\$E\$/\$\textbackslash overline\{E\}\$\}]} + +\tikzstyle{BernProbaS} = [text=violet,fill=white,sloped,midway,font=\scriptsize] +\tikzstyle{BernProbaE} = [text=red,fill=white,sloped,midway,font=\scriptsize] +\tikzstyle{BernBranche} = [semithick,blue,->] +\hfill\tkzSchemBernoulli*[N=2,EspNiv=3,EspFeuil=1.25,Notice,Racine=false,Probas={\num{0.75}/\num{0.25}},Evts={$E$/$\overline{E}$}]\hfill~ +\tkzSchemBernStyleDefaut +\end{tcolorbox} + +\vfill~ + +\pagebreak + +\phantomsection + +\hypertarget{matoc}{} + +\tableofcontents + +\vspace*{5mm} + +\hrule + +\vspace*{5mm} + +\section{Le package tkz-bernoulli} + +\subsection{Introduction} + +L'idée du package \MontreCode{tkz-bernoulli} est de proposer des commandes pour représenter un schéma de Bernoulli, dans le cadre d'une loi binomiale par exemple, avec la possibilité de : + +\begin{itemize} + \item personnaliser les dimensions et styles ; + \item rajouter des éléments a posteriori, grâce aux nœuds créés. +\end{itemize} + +\subsection{Chargement} + +Le package se charge dans le préambule, via \MontreCode{\textbackslash usepackage\{tkz-bernoulli\}}. + +Les seuls packages chargés sont : + +\begin{itemize} + \item \MontreCode{xstring}, \MontreCode{pgffor} et \MontreCode{simplekv} ; + \item \MontreCode{xintexpr} et \MontreCode{xintbinhex} ; + \item \MontreCode{tikz} avec la librairie \MontreCode{calc}. +\end{itemize} + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\usepackage{tkz-bernoulli} +\end{codehigh} + +{\small\faAngleDoubleRight}~\MontreCode{tkz-bernoulli} est compatible avec les compilations usuelles en \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} ou \textsf{xelatex}. + +\subsection{Commandes disponibles} + +Les commandes proposées par le package \MontreCode{tkz-bernoulli} sont : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%commande à insérer dans un environnement tikzpicture, pour rajouts éventuels +\begin{tikzpicture} + \tkzSchemBernoulli +\end{tikzpicture} +\end{codehigh} + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%commande autonome +\tkzSchemBernoulli* +\end{codehigh} + +\subsection{Styles par défaut} + +Le package propose des styles prédéfinis, pour : + +\begin{itemize} + \item la racine et les nœuds ; + \item les branches ; + \item les probabilités. +\end{itemize} + +Pour modifier, en \textit{profondeur}, le style de l'arbre, il suffira de redéfinir les styles suivants (une commande est disponible pour remettre tous les styles par défaut) : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%style par défaut des branches +\tikzstyle{BernBranche} = [semithick] + +%style par défaut du label de la racine, si affichée +\tikzstyle{BernRacine} = [inner sep=2pt] + +%styles par défaut des noeuds relatifs à Succès/Échec +\tikzstyle{BernNoeudS} = [inner sep=2pt] +\tikzstyle{BernNoeudE} = [inner sep=2pt] + +%styles par défaut des probas relatives à Succès/Échec +\tikzstyle{BernProbaS} = [fill=white,midway,font=\footnotesize,inner sep=1.5pt] +\tikzstyle{BernProbaE} = [fill=white,midway,font=\footnotesize,inner sep=1.5pt] + +%style par défaut des valeurs prises par la v.a. +\tikzstyle{BernNotice} = [inner sep=2pt,text=teal,right=1em] +\end{codehigh} + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%commande de remise des styles par défaut +\tkzSchemBernStyleDefaut +\end{codehigh} + +\section{Les commandes} + +\subsection{Commande à insérer dans un environnement tikzpicture} + +La commande dédiée pour insertion dans un environnement \textsf{tikzpicture} est \MontreCode{\textbackslash tkzSchemBernoulli} : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%commande à insérer dans un environnement tikzpicture, pour rajouts éventuels +\begin{tikzpicture} + \tkzSchemBernoulli[clés] +\end{tikzpicture} +\end{codehigh} + +Concernant cette commande : + +\begin{itemize} + \item les clés disponibles sont : + \begin{itemize} + \item \MontreCode{EspNiv} := espace horizontal entre les niveaux (\MontreCode{2.25} par défaut) ; + \item \MontreCode{EspFeuil} := espace vertical entre les éléments du dernier niveau (\MontreCode{1} par défaut) ; + \item \MontreCode{Evts} := nom des évènements Succès/Échec (\MontreCode{\$S\$/\$E\$} par défaut) ; + \item \MontreCode{Probas} := probabilités (\MontreCode{\$p\$/\$1-p\$} par défaut) ; + \item \MontreCode{AffProbas} := booléen pour afficher les probabilités (\MontreCode{true} par défaut) ; + \item \MontreCode{Racine} := nom qui apparaît pour la racine(\MontreCode{\$\textbackslash Omega\$} par défaut, ou \MontreCode{false} pour désactiver) ; + \item \MontreCode{Aide} := booléen pour afficher les noms des nœuds créés (\MontreCode{false} par défaut) ; + \item \MontreCode{Notice} := booléen pour afficher les valeurs prises par la v.a. (\MontreCode{false} par défaut) ; + \item \MontreCode{Var} := nom de la v.a. pour la notice (\MontreCode{X} par défaut) ; + \item \MontreCode{N} := paramètre $n$ du schéma de Bernoulli (\MontreCode{3} par défaut). + \end{itemize} +\end{itemize} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\begin{tikzpicture} + \tkzSchemBernoulli +\end{tikzpicture} +\end{demohigh} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%les nœuds sont nommés sous la forme (B<niveau>-<numéro>) +\begin{tikzpicture} + \tkzSchemBernoulli[Aide,Notice,AffProbas=false,EspNiv=3.25,EspFeuil=0.75,N=4] +\end{tikzpicture} +\end{demohigh} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%\usepackage{nicefrac} +\begin{tikzpicture} + \tkzSchemBernoulli[% + Evts={$A$/$\overline{A}$},% + EspFeuil=0.75,% + Probas={$\nicefrac{1}{6}$/$\nicefrac{5}{6}$}] +\end{tikzpicture} +\end{demohigh} + +\subsection{Commande autonome} + +La commande dédiée pour insertion autonome est \MontreCode{\textbackslash tkzSchemBernoulli*} : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%commande autonome +\tkzSchemBernoulli*[clés]<options tikz> +\end{codehigh} + +Concernant cette commande : + +\begin{itemize} + \item l'environnement \textsf{tikzpicture} est automatiquement créé ; + \item les \textsf{clés} sont les mêmes que pour la commande non étoilée ; + \item des \MontreCode{<options tikz>}, optionnels, peuvent être passées à l'environnement \textsf{tikzpicture}. +\end{itemize} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\tkzSchemBernoulli* +\end{demohigh} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\tkzSchemBernoulli*[Notice,AffProbas=false,EspNiv=3.25,EspFeuil=0.75,N=4,Aide] +\end{demohigh} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%\usepackage{nicefrac} +\tkzSchemBernoulli*[% + N=6,EspFeuil=0.35,Notice,% + Probas={$\nicefrac{1}{6}$/$\nicefrac{5}{6}$}] + <scale=0.75,every node/.style={scale=0.5}> +\end{demohigh} + +\pagebreak + +\subsection{Mofication avancée des styles} + +Les \textsf{clés} relatives aux commandes précédentes permettent de modifier l'aspect \textit{global} de l'arbre, mais les styles particuliers des éléments peuvent également être modifiés, comme indiqué au début de cette documentation. + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\tikzstyle{BernBranche} = [thick,red,->] +\tikzstyle{BernRacine} = [] +\tikzstyle{BernNoeudS} = [draw,rectangle,inner sep=1.5pt] +\tikzstyle{BernNoeudE} = [draw,rectangle,inner sep=1.5pt] +\tikzstyle{BernProbaS} = [text=teal,midway,fill=cyan!5,inner sep=1.5pt] +\tikzstyle{BernProbaE} = [text=orange,midway,fill=purple!5,inner sep=1.5pt] +\tkzSchemBernoulli* +\end{demohigh} + +\pagebreak + +\section{English commands} + +\subsection{Introduction} + +There's also english versions of the commands and keys : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%command in an environment tikzpicture +\begin{tikzpicture} + \tkzBernoulliTree[keys] +\end{tikzpicture} +\end{codehigh} + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%stand-alone command +\tkzBernoulliTree*[keys]<tikz options> +\end{codehigh} + +Default styles are given by : + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%style for edges +\tikzstyle{BernEdge} = [semithick] + +%style for root (if displayed) +\tikzstyle{BernRoot} = [inner sep=2pt] + +%styles for nodes Success/Failure +\tikzstyle{BernNodeS} = [inner sep=2pt] +\tikzstyle{BernNodeF} = [inner sep=2pt] + +%styles for probas Success/Failure +\tikzstyle{BernProbS} = [fill=white,midway,font=\footnotesize,inner sep=2pt] +\tikzstyle{BernProbF} = [fill=white,midway,font=\footnotesize,inner sep=2pt] + +%style for values taken by X +\tikzstyle{BernGuide} = [inner sep=2pt,text=teal,right=1em] +\end{codehigh} + +\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%command to restore default styles +\tkzBernTreeStyleDefault +\end{codehigh} + +\subsection{Examples} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +\begin{tikzpicture} + \tkzBernoulliTree +\end{tikzpicture} +\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] +\end{demohigh} + +\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] +%\usepackage{nicefrac} +\tikzstyle{BernEdge} = [thick,red,->] +\tikzstyle{BernRoot} = [] +\tikzstyle{BernNodeS} = [draw,rectangle,fill=yellow,inner sep=1.5pt] +\tikzstyle{BernNodeF} = [draw,rectangle,fill=orange,inner sep=1.5pt] +\tikzstyle{BernProbS} = [text=teal,midway,fill=cyan!5,inner sep=1.5pt] +\tikzstyle{BernProbF} = [text=orange,midway,fill=purple!5,inner sep=1.5pt] +\tikzstyle{BernGuide} = [draw,rectangle,inner sep=2pt,text=green,right=2em] +\tkzBernoulliTree*[% + Events={$A$/$\overline{A}$},% + NodeSep=0.75,Guide,% + Probs={$\nicefrac{1}{6}$/$\nicefrac{5}{6}$}] +\end{demohigh} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty b/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty new file mode 100644 index 00000000000..88e3ebaed46 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkz-bernoulli/tkz-bernoulli.sty @@ -0,0 +1,328 @@ +% Author : C. Pierquet +% 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] + +%====HISTORIQUE +% v 0.1.0 Version initiale [fr] et [en] + +%====BASE +\RequirePackage{tikz,pgffor} +\RequirePackage{xstring} +\RequirePackage{simplekv} +\RequirePackage{xintexpr,xintbinhex} +\usetikzlibrary{calc} + +%====SCHÉMA DE BERNOULLI [FR] +%styles par défaut +\tikzstyle{BernBranche} = [semithick] +\tikzstyle{BernRacine} = [inner sep=2pt] +\tikzstyle{BernNoeudS} = [inner sep=2pt] +\tikzstyle{BernNoeudE} = [inner sep=2pt] +\tikzstyle{BernProbaS} = [fill=white,midway,font=\footnotesize,inner sep=2pt] +\tikzstyle{BernProbaE} = [fill=white,midway,font=\footnotesize,inner sep=2pt] +\tikzstyle{BernNotice} = [inner sep=2pt,text=teal,right=1em] + +%commande de personnalisations +% \NewDocumentCommand\tkzSchemBernStyle{ m m }{%1=type,2=tikzstyle + % \xdef\BernStyle{\noexpand#2} + % \IfStrEq{#2}{defaut}% + % {% + % \IfStrEq{#1}{branche}{\tikzstyle{BernBranche} = [semithick]}{}% + % \IfStrEq{#1}{racine}{\tikzstyle{BernRacine} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{noeudS}{\tikzstyle{BernNoeudS} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{noeudE}{\tikzstyle{BernNoeudE} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{probaS}{\tikzstyle{BernProbaS} = [fill=white,midway,font=\footnotesize]}{}% + % \IfStrEq{#1}{probaE}{\tikzstyle{BernProbaE} = [fill=white,midway,font=\footnotesize]}{}% + % \IfStrEq{#1}{notice}{\tikzstyle{BernNotice} = [inner sep=2pt,text=teal,right=1em]}{}% + % }% + % {% + % \IfStrEq{#1}{branche}{\tikzstyle{BernBranche} = [\BernStyle]}{}% + % \IfStrEq{#1}{racine}{\tikzstyle{BernRacine} = [\BernStyle]}{}% + % \IfStrEq{#1}{noeudS}{\tikzstyle{BernNoeudS} = [\BernStyle]}{}% + % \IfStrEq{#1}{noeudE}{\tikzstyle{BernNoeudE} = [\BernStyle]}{}% + % \IfStrEq{#1}{probaS}{\tikzstyle{BernProbaS} = [\BernStyle]}{}% + % \IfStrEq{#1}{probaE}{\tikzstyle{BernProbaE} = [\BernStyle]}{}% + % \IfStrEq{#1}{notice}{\tikzstyle{BernNotice} = [\BernStyle]}{}% + % }% +% } + +\NewDocumentCommand\tkzSchemBernStyleDefaut{ }{% + \tikzstyle{BernBranche} = [semithick] + \tikzstyle{BernRacine} = [inner sep=2pt] + \tikzstyle{BernNoeudS} = [inner sep=2pt] + \tikzstyle{BernNoeudE} = [inner sep=2pt] + \tikzstyle{BernProbaS} = [fill=white,midway,font=\footnotesize,inner sep=2pt] + \tikzstyle{BernProbaE} = [fill=white,midway,font=\footnotesize,inner sep=2pt] + \tikzstyle{BernNotice} = [inner sep=2pt,text=teal,right=1em] +} + +%clés +\defKV[ArbreBernoulli]{% + EspNiv=\def\ArBinIN{#1},% + EspFeuil=\def\ArBinIF{#1},% + Evts=\def\ArBinEvts{#1},% + Probas=\def\ArBinProbas{#1},% + Racine=\def\ArBinRacine{#1},% + Var=\def\ArBinVar{#1},% + N=\def\ArBinN{#1} +} + +\setKVdefault[ArbreBernoulli]{% + EspNiv=2.25,% + EspFeuil=1,% + Evts={$S$/$E$},% + Probas={$p$/$1-p$},% + Grille=false,% + AffProbas=true,% + Racine=$\Omega$,% + Aide=false,% + Notice=false,% + Var=X,% + N=3 +} + +\NewDocumentCommand\tkzSchemBernoulli{ s O{} D<>{} }{% + \useKVdefault[ArbreBernoulli]% + \setKV[ArbreBernoulli]{#2}% + \saveexpandmode\expandarg + \StrCut{\ArBinEvts}{/}{\ArBinSucces}{\ArBinEchec}% + \StrCut{\ArBinProbas}{/}{\ArBinProbSucces}{\ArBinProbEchec}% + \restoreexpandmode + \IfBooleanT{#1}% + {% + \begin{tikzpicture}[#3] + }% + %grille + \ifboolKV[ArbreBernoulli]{Grille}% + {% + \filldraw[red!25] (0,0) circle[radius=2pt] ; + \draw[very thin,lightgray] (0,{-0.5*\ArBinIF*2^(\ArBinN)}) grid ({\ArBinN*\ArBinIN},{0.5*\ArBinIF*2^(\ArBinN)}) ;% + }% + {}% + %Racine + \IfStrEq{\ArBinRacine}{false}% + {% + \coordinate (B0-1) at (0,0) ;% + }% + {% + \coordinate (A0-1) at (0,0) ;% + \node[BernRacine] (B0-1) at (A0-1) {\ArBinRacine} ;% + }% + %Aide Racine + \ifboolKV[ArbreBernoulli]{Aide}% + {\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}{% + \def\j{\inteval{\i-1}}% + \def\ArBinTmpNiv{\fpeval{2**(\ArBinN-\i)}}% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \coordinate (A\i-1) at ($(A\j-1)+({\ArBinIN},{0.5*\ArBinIF*\ArBinTmpNiv})$) ; + \foreach \k in {2,...,\ArBinTmpNds}{% + \def\l{\inteval{\k-1}}% + \coordinate (A\i-\k) at ($(A\i-\l)+(0,{-\ArBinIF*\ArBinTmpNiv})$) ; + }% + }% + %test des nœuds OK ^^ + \foreach \i in {1,...,\ArBinN}{% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \foreach \j in {1,...,\ArBinTmpNds}{% + \xintifboolexpr{\xintiiRem{\j}{2} != 0 }% + {\node[BernNoeudS] (B\i-\j) at (A\i-\j) {\ArBinSucces} ;}%succès + {\node[BernNoeudE] (B\i-\j) at (A\i-\j) {\ArBinEchec} ;}%échec + \ifboolKV[ArbreBernoulli]{Aide}% + {\draw[teal] (B\i-\j) node[below=4pt,font=\tiny\ttfamily] {B\i-\j} ;}% + {}% + }% + }% + %test des flèches... + \foreach \i in {0,...,\inteval{\ArBinN-1}}{% + \def\ipu{\inteval{\i+1}}% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \foreach \j in {1,...,\ArBinTmpNds}{% + \def\ArBinTmpA{\inteval{2*\j-1}}% + \def\ArBinTmpB{\inteval{2*\j}}% + \ifboolKV[ArbreBernoulli]{AffProbas}% + {% + \draw[BernBranche] (B\i-\j) -- (B\ipu-\ArBinTmpA) node[BernProbaS] {\ArBinProbSucces} ; + \draw[BernBranche] (B\i-\j) -- (B\ipu-\ArBinTmpB) node[BernProbaE] {\ArBinProbEchec} ; + }% + {% + \draw[BernBranche] (B\i-\j) -- (B\ipu-\ArBinTmpA) ; + \draw[BernBranche] (B\i-\j) -- (B\ipu-\ArBinTmpB) ; + }% + }% + }% + \ifboolKV[ArbreBernoulli]{Notice}% + {% + \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}$} ; + }% + }% + {}% + \IfBooleanT{#1}% + {% + \end{tikzpicture}% + }% +} + +%====SCHÉMA DE BERNOULLI [EN] +%styles par défaut [en] +\tikzstyle{BernEdge} = [semithick] +\tikzstyle{BernRoot} = [inner sep=2pt] +\tikzstyle{BernNodeS} = [inner sep=2pt] +\tikzstyle{BernNodeF} = [inner sep=2pt] +\tikzstyle{BernProbS} = [fill=white,midway,font=\footnotesize,inner sep=2pt] +\tikzstyle{BernProbF} = [fill=white,midway,font=\footnotesize,inner sep=2pt] +\tikzstyle{BernGuide} = [inner sep=2pt,text=teal,right=1em] + +%commande de personnalisations [en] +% \NewDocumentCommand\tkzBernTreeStyle{ m m }{%1=type,2=tikzstyle + % \IfStrEq{#2}{default}% + % \IfStrEq{#2}{defaut}% + % {% + % \IfStrEq{#1}{edge}{\tikzstyle{BernEdge} = [semithick]}{}% + % \IfStrEq{#1}{root}{\tikzstyle{BernRoot} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{nodeS}{\tikzstyle{BernNodeS} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{nodeF}{\tikzstyle{BernNodeF} = [inner sep=2pt]}{}% + % \IfStrEq{#1}{probS}{\tikzstyle{BernProbS} = [fill=white,midway,font=\footnotesize]}{}% + % \IfStrEq{#1}{probF}{\tikzstyle{BernProbF} = [fill=white,midway,font=\footnotesize]}{}% + % \IfStrEq{#1}{guide}{\tikzstyle{BernGuide} = [inner sep=2pt,text=teal,right=1em]}{}% + % }% + % {% + % \IfStrEq{#1}{edge}{\tikzstyle{BernEdge} = [#2]}{}% + % \IfStrEq{#1}{root}{\tikzstyle{BernRoot} = [#2]}{}% + % \IfStrEq{#1}{nodeS}{\tikzstyle{BernNodeS} = [#2]}{}% + % \IfStrEq{#1}{nodeF}{\tikzstyle{BernNodeF} = [#2]}{}% + % \IfStrEq{#1}{probS}{\tikzstyle{BernProbS} = [#2]}{}% + % \IfStrEq{#1}{probF}{\tikzstyle{BernProbF} = [#2]}{}% + % \IfStrEq{#1}{guide}{\tikzstyle{BernGuide} = [#2]}{}% + % }% +% } + +\NewDocumentCommand\tkzBernTreeStyleDefault{ }{%1=type,2=tikzstyle + \tikzstyle{BernEdge} = [semithick] + \tikzstyle{BernRoot} = [inner sep=2pt] + \tikzstyle{BernNodeS} = [inner sep=2pt] + \tikzstyle{BernNodeF} = [inner sep=2pt] + \tikzstyle{BernProbS} = [fill=white,midway,font=\footnotesize,inner sep=2pt] + \tikzstyle{BernProbF} = [fill=white,midway,font=\footnotesize,inner sep=2pt] + \tikzstyle{BernGuide} = [inner sep=2pt,text=teal,right=1em] +} + +\defKV[BernoulliTree]{% + LevelSep=\def\ArBinIN{#1},% + NodeSep=\def\ArBinIF{#1},% + Events=\def\ArBinEvts{#1},% + Probs=\def\ArBinProbas{#1},% + Root=\def\ArBinRacine{#1},% + Var=\def\ArBinVar{#1},% + N=\def\ArBinN{#1} +} + +\setKVdefault[BernoulliTree]{% + LevelSep=2.25,% + NodeSep=1,% + Events={$S$/$E$},% + Probs={$p$/$1-p$},% + Grid=false,% + ShowProbs=true,% + Root=$\Omega$,% + Help=false,% + Guide=false,% + Var=X,% + N=3 +} + +\NewDocumentCommand\tkzBernoulliTree{ s O{} D<>{} }{% + \useKVdefault[BernoulliTree]% + \setKV[BernoulliTree]{#2}% + \saveexpandmode\expandarg + \StrCut{\ArBinEvts}{/}{\ArBinSucces}{\ArBinEchec}% + \StrCut{\ArBinProbas}{/}{\ArBinProbSucces}{\ArBinProbEchec}% + \restoreexpandmode + \IfBooleanT{#1}% + {% + \begin{tikzpicture}[#3] + }% + %grille + \ifboolKV[BernoulliTree]{Grid}% + {% + \filldraw[red!25] (0,0) circle[radius=2pt] ; + \draw[very thin,lightgray] (0,{-0.5*\ArBinIF*2^(\ArBinN)}) grid ({\ArBinN*\ArBinIN},{0.5*\ArBinIF*2^(\ArBinN)}) ;% + }% + {}% + %Racine + \IfStrEq{\ArBinRacine}{false}% + {% + \coordinate (B0-1) at (0,0) ;% + }% + {% + \coordinate (A0-1) at (0,0) ;% + \node[BernRoot] (B0-1) at (A0-1) {\ArBinRacine} ;% + }% + %Aide Racine + \ifboolKV[BernoulliTree]{Help}% + {\draw[teal] (B0-1) node[below=4pt,font=\tiny\ttfamily] {A00} ;}% + {}% + %générations des nœuds du premier chemin + \foreach \i in {1,...,\ArBinN}{% + \def\j{\inteval{\i-1}}% + \def\ArBinTmpNiv{\fpeval{2**(\ArBinN-\i)}}% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \coordinate (A\i-1) at ($(A\j-1)+({\ArBinIN},{0.5*\ArBinIF*\ArBinTmpNiv})$) ; + \foreach \k in {2,...,\ArBinTmpNds}{% + \def\l{\inteval{\k-1}}% + \coordinate (A\i-\k) at ($(A\i-\l)+(0,{-\ArBinIF*\ArBinTmpNiv})$) ; + }% + }% + %test des nœuds OK ^^ + \foreach \i in {1,...,\ArBinN}{% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \foreach \j in {1,...,\ArBinTmpNds}{% + \xintifboolexpr{\xintiiRem{\j}{2} != 0 }% + {\node[BernNodeS] (B\i-\j) at (A\i-\j) {\ArBinSucces} ;}%succès + {\node[BernNodeF] (B\i-\j) at (A\i-\j) {\ArBinEchec} ;}%échec + \ifboolKV[BernoulliTree]{Help}% + {\draw[teal] (B\i-\j) node[below=4pt,font=\tiny\ttfamily] {B\i-\j} ;}% + {}% + }% + }% + %test des flèches... + \foreach \i in {0,...,\inteval{\ArBinN-1}}{% + \def\ipu{\inteval{\i+1}}% + \def\ArBinTmpNds{\fpeval{2**(\i)}}% + \foreach \j in {1,...,\ArBinTmpNds}{% + \def\ArBinTmpA{\inteval{2*\j-1}}% + \def\ArBinTmpB{\inteval{2*\j}}% + \ifboolKV[BernoulliTree]{ShowProbs}% + {% + \draw[BernEdge] (B\i-\j) -- (B\ipu-\ArBinTmpA) node[BernProbS] {\ArBinProbSucces} ; + \draw[BernEdge] (B\i-\j) -- (B\ipu-\ArBinTmpB) node[BernProbF] {\ArBinProbEchec} ; + }% + {% + \draw[BernEdge] (B\i-\j) -- (B\ipu-\ArBinTmpA) ; + \draw[BernEdge] (B\i-\j) -- (B\ipu-\ArBinTmpB) ; + }% + }% + }% + \ifboolKV[BernoulliTree]{Guide}% + {% + \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}$} ; + }% + }% + {}% + \IfBooleanT{#1}% + {% + \end{tikzpicture}% + }% +} + +\endinput
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 10590bd9341..60878170ae1 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -839,8 +839,8 @@ my @TLP_working = qw( tikztosvg tikzviolinplots tile-graphic tilings timbreicmc times timetable timing-diagrams tinos tipa tipa-de tipauni tipfr tiscreen titlecaps titlefoot titlepages titlepic titleref titlesec titling - tkz-base tkz-berge tkz-doc tkz-euclide tkz-fct tkz-graph tkz-tab - tkz-orm tkzexample + tkz-base tkz-berge tkz-bernoulli tkz-doc tkz-euclide + tkz-fct tkz-graph tkz-orm tkz-tab tkzexample tlc-article tlc2 tlc3-examples tlcockpit tlmgr-intro-zh-cn tlmgrbasics to-be-determined tocbibind tocdata tocloft tocvsec2 todo todonotes tokcycle tokenizer tonevalue toolbox tools diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index cb6a2b175cb..c7ce0c89d00 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1841,6 +1841,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'tikz-ext' => '&POSTtikz_ext', 'tipa-de' => '&POST_rmsymlink', 'tkz-berge' => '&POSTtkz_berge', + 'tkz-bernoulli' => '&POST_onelevel', 'tlcockpit' => '&POST_do_man', 'tlc3-examples' => '&POSTtlc3_examples', 'tudscr' => '&POSTtudscr', diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index 382d7332f14..fdfb168cb21 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -226,6 +226,7 @@ depend timing-diagrams depend tipfr depend tkz-base depend tkz-berge +depend tkz-bernoulli depend tkz-doc depend tkz-euclide depend tkz-fct diff --git a/Master/tlpkg/tlpsrc/tkz-bernoulli.tlpsrc b/Master/tlpkg/tlpsrc/tkz-bernoulli.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/tkz-bernoulli.tlpsrc |