在瓮中画彩色球

在瓮中画彩色球

我想在我的乳胶代码中绘制并添加这两个框

在此处输入图片描述

我的代码是

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts,tikz}
\usepackage[paperheight=5in,paperwidth=10in,left=2cm,right=1cm,top=1.5cm,bottom=2.5cm]{geometry}
\usepackage{varwidth}
\usepackage{mathrsfs}
\definecolor{col4}{RGB}{72, 114, 198}
\definecolor{col1}{RGB}{32, 114, 98}
\definecolor{col2}{RGB}{32, 58, 95 }
\definecolor{col3}{RGB}{45, 85, 155}
\everymath{\displaystyle}
\usepackage[varbb]{newpxmath}
\usepackage{dsfont}
\newcommand*\mycirc[1]{%
\begin{tikzpicture}[baseline=(C.base)]
\node[draw,circle,inner sep=1pt,minimum size=3ex](C) {#1};
\end{tikzpicture}}
\usepackage{romanbar}
\pagestyle{empty}
\usepackage[most,breakable]{tcolorbox}
\usetikzlibrary{shapes.arrows,calc}
\newtcolorbox{mybox}[1][]{%
enhanced,interior code app={\fill[line width=1pt,col1] ( [yshift=-1cm]frame.north east)to[out=140,in=60]( [xshift=-2cm]frame.south east)--++(2cm,0)--cycle;},width=17.7cm,arc=0pt,outer arc=0pt ,colback=white,colframe=blue,
frame code app={\fill[line width=0.2pt,col1]( frame.north west)rectangle (frame.south east);}
}
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{eso-pic}
\AddToShipoutPictureBG{\ifnum\value{page}=1\begin{tikzpicture}[remember picture,overlay]
\fill[col1]([yshift=1cm]current page.south west)rectangle(current page.south east) ;
\node[circle,draw=white,line width=2pt,minimum size=0.3cm,fill=col1]at([yshift=0.9cm]current page.south){{\thepage}};
\node[anchor=north west,rectangle,fill=col1!85,rotate=90,inner sep=0.3cm,](A)at([yshift=1.5cm]current page.south west){{\large \textbf{\color{white}Les probabilités}}};
\end{tikzpicture}\else
\begin{tikzpicture}[remember picture,overlay]
\fill[col1]([yshift=-0.5cm]current page.north west)rectangle(current page.north east) ;
\fill[col1]([yshift=1cm]current page.south west)rectangle(current page.south east) ;
\node[circle,draw=white,line width=2pt,minimum size=0.3cm,fill=col1]at([yshift=0.9cm]current page.south){{\thepage}};
\node[anchor=north west,rectangle,fill=col1!85,rotate=90,inner sep=0.3cm,](A)at([yshift=1.5cm]current page.south west){{\large \textbf{\color{white}Les probabilités}}};
\end{tikzpicture}
\fi }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter ]{Exercice}[2][]{
enhanced,top=0.5cm,bottom=0.5cm,
overlay app={\draw[col1,line width=0.5cm] (frame.south west)--(frame.north west);
\node[rectangle,fill=violet,inner xsep=0.3cm, anchor=south east] at([xshift=-0.3cm]frame.north east){\textbf{\color{white}#1}};},
colback=white,colbacktitle=white,breakable,after=\vskip1cm,
fonttitle=\bfseries,coltitle=col1,colframe=col1,
attach boxed title to top left={xshift=0.5cm,yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
title={\textbf{Exercice n$^{\circ}$\thetcbcounter :}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\cir[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill=col4,draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{white}#1};}}
\newcommand*\mycir[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill=yellow, draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{col4}#1};}}
\usepackage{enumitem}
\begin{document}
\begin{Exercice}[Examen National $2015$ Normale]{}
Une urne $\mathbb{U}_{1}$ contient $7$ boules :  {\color{red} $4$ rouges} et  {\color{green} $3$ vertes} (indiscernables au toucher)

Une urne $\mathbb{U}_{2}$ contient $5$ boules :  {\color{red} $3$ rouges} et  {\color{green} $2$ vertes} (indiscernables au toucher)

\vspace{0.5cm}
{\color{red}{\protect\cir{{\Large  \Romanbar{1} }}}} On considère l'expérience suivante : On tire au hasard et simultanément trois boules de l'urne $U_{1}$.

Soit l'événement $\mathcal{A}$ : "obtenir une boule {\color{red} rouge} et deux boules {\color{green} vertes}"

\hspace{0.25cm} et l'événement $\mathcal{B}$ : "obtenir trois boules de la même couleur"

\hspace{1cm} {\color{blue} $\Rightarrow$} Montrer que $\mathds{P}\left ( \mathcal{A} \right )=\frac{12}{35}$ et $\mathds{P}\left ( \mathcal{B} \right )=\frac{1}{7}$

{\color{red}{\protect\cir{{\Large  \Romanbar{2} }}}} On considère l'expérience suivante : On tire au hasard et en même temps deux boules de $\mathbb{U}_{1}$, puis on tire au hasard une boule de $\mathbb{U}_{2}$

Soit l'événement $\mathcal{C}$ : "obtenir trois boules {\color{red} rouges}"

\hspace{1cm} {\color{blue} $\Rightarrow$} Montrer que $\mathds{P}\left ( \mathcal{C} \right )=\frac{6}{35}$
\end{Exercice}
\end{document} 

答案1

还有另一种可能性:

带有彩色球的骨灰盒。

代码:

\documentclass[svgnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts,tikz}
\usepackage[paperheight=5in,paperwidth=10in,left=2cm,right=1cm,top=1.5cm,bottom=2.5cm]{geometry}
\usepackage{varwidth}
\usepackage{mathrsfs}
\definecolor{col4}{RGB}{72, 114, 198}
\definecolor{col1}{RGB}{32, 114, 98}
\definecolor{col2}{RGB}{32, 58, 95 }
\definecolor{col3}{RGB}{45, 85, 155}
\everymath{\displaystyle}
\usepackage[varbb]{newpxmath}
\usepackage{dsfont}

\usepackage{ifthen}% <-- added

\newcommand*\mycirc[1]{%
\begin{tikzpicture}[baseline=(C.base)]
\node[draw,circle,inner sep=1pt,minimum size=3ex](C) {#1};
\end{tikzpicture}}
\usepackage{romanbar}
\pagestyle{empty}
\usepackage[most,breakable]{tcolorbox}
\usetikzlibrary{shapes.arrows,calc,fit}% <-- added fit
\newtcolorbox{mybox}[1][]{%
enhanced,interior code app={\fill[line width=1pt,col1] ( [yshift=-1cm]frame.north east)to[out=140,in=60]( [xshift=-2cm]frame.south east)--++(2cm,0)--cycle;},width=17.7cm,arc=0pt,outer arc=0pt ,colback=white,colframe=blue,
frame code app={\fill[line width=0.2pt,col1]( frame.north west)rectangle (frame.south east);}
}
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{eso-pic}
\AddToShipoutPictureBG{\ifnum\value{page}=1\begin{tikzpicture}[remember picture,overlay]
\fill[col1]([yshift=1cm]current page.south west)rectangle(current page.south east) ;
\node[circle,draw=white,line width=2pt,minimum size=0.3cm,fill=col1]at([yshift=0.9cm]current page.south){{\thepage}};
\node[anchor=north west,rectangle,fill=col1!85,rotate=90,inner sep=0.3cm,](A)at([yshift=1.5cm]current page.south west){{\large \textbf{\color{white}Les probabilités}}};
\end{tikzpicture}\else
\begin{tikzpicture}[remember picture,overlay]
\fill[col1]([yshift=-0.5cm]current page.north west)rectangle(current page.north east) ;
\fill[col1]([yshift=1cm]current page.south west)rectangle(current page.south east) ;
\node[circle,draw=white,line width=2pt,minimum size=0.3cm,fill=col1]at([yshift=0.9cm]current page.south){{\thepage}};
\node[anchor=north west,rectangle,fill=col1!85,rotate=90,inner sep=0.3cm,](A)at([yshift=1.5cm]current page.south west){{\large \textbf{\color{white}Les probabilités}}};
\end{tikzpicture}
\fi }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter ]{Exercice}[2][]{
enhanced,top=0.5cm,bottom=0.5cm,
overlay app={\draw[col1,line width=0.5cm] (frame.south west)--(frame.north west);
\node[rectangle,fill=violet,inner xsep=0.3cm, anchor=south east] at([xshift=-0.3cm]frame.north east){\textbf{\color{white}#1}};},
colback=white,colbacktitle=white,breakable,after=\vskip1cm,
fonttitle=\bfseries,coltitle=col1,colframe=col1,
attach boxed title to top left={xshift=0.5cm,yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
title={\textbf{Exercice n$^{\circ}$\thetcbcounter :}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\cir[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill=col4,draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{white}#1};}}
\newcommand*\mycir[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill=yellow, draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{col4}#1};}}
\usepackage{enumitem}
\begin{document}
\begin{Exercice}[Examen National $2015$ Normale]{}
Une urne $\mathbb{U}_{1}$ contient $7$ boules :  {\color{red} $4$ rouges} et  {\color{ForestGreen} $3$ vertes} (indiscernables au toucher)

Une urne $\mathbb{U}_{2}$ contient $5$ boules :  {\color{red} $3$ rouges} et  {\color{ForestGreen} $2$ vertes} (indiscernables au toucher)

%%% added urnes
\vspace{.25cm}
\hspace{1cm}
% nouveau: dessiner les urnes avec des boules
\newcommand\drawBoule[2]{%
    \ifthenelse{\equal{#1}{R}} {
        \node[boule=red] at (#2) {$#1$};
    }{
        \node[boule=ForestGreen] at (#2) {$#1$};
    }
}
\begin{tikzpicture}[
    scale=.75,
    boule/.style={
        circle,draw,
        inner sep=2pt,
        fill=#1,
        text=white,
        font=\footnotesize
    }
]
    \begin{scope}[local bounding box=urne1]
        \foreach \content [count=\c] in {R,V,V} {
            \drawBoule{\content}{.8*\c + .4,0}
        }
        \foreach \content [count=\c] in {R,V,R,R} {
            \drawBoule{\content}{.8*\c,-3/4}
        }
    \end{scope}
    \draw ([xshift=-.15cm] urne1.north west) |- ([xshift=.15cm, yshift=-.15cm] urne1.south east) -- ([xshift=.15cm] urne1.north east);
    \node[xshift=1cm] at (urne1.east) {urne $U_1$};

    \begin{scope}[xshift=8cm]
        \begin{scope}[local bounding box=urne2]
            \foreach \content [count=\c] in {V,R} {
                \drawBoule{\content}{.8*\c + .4,0}
            }
            \foreach \content [count=\c] in {R,R,V} {
                \drawBoule{\content}{.8*\c,-3/4}
            }
        \end{scope}
        \draw ([xshift=-.15cm] urne2.north west) |- ([xshift=.15cm, yshift=-.15cm] urne2.south east) -- ([xshift=.15cm] urne2.north east);
        \node[xshift=1cm] at (urne2.east) {urne $U_2$};
    \end{scope}
\end{tikzpicture}
\vspace{.25cm}
%%%

{\color{red}{\protect\cir{{\Large  \Romanbar{1} }}}} On considère l'expérience suivante : On tire au hasard et simultanément trois boules de l'urne $U_{1}$.

Soit l'événement $\mathcal{A}$ : "obtenir une boule {\color{red} rouge} et deux boules {\color{ForestGreen} vertes}"

\hspace{0.25cm} et l'événement $\mathcal{B}$ : "obtenir trois boules de la même couleur"

\hspace{1cm} {\color{blue} $\Rightarrow$} Montrer que $\mathds{P}\left ( \mathcal{A} \right )=\frac{12}{35}$ et $\mathds{P}\left ( \mathcal{B} \right )=\frac{1}{7}$

{\color{red}{\protect\cir{{\Large  \Romanbar{2} }}}} On considère l'expérience suivante : On tire au hasard et en même temps deux boules de $\mathbb{U}_{1}$, puis on tire au hasard une boule de $\mathbb{U}_{2}$

Soit l'événement $\mathcal{C}$ : "obtenir trois boules {\color{red} rouges}"

\hspace{1cm} {\color{blue} $\Rightarrow$} Montrer que $\mathds{P}\left ( \mathcal{C} \right )=\frac{6}{35}$
\end{Exercice}
\end{document}

答案2

我们将它们视为两个tikzpictures。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath,amssymb,tikz}
\usepackage[paperheight=5in,paperwidth=10in,left=2cm,right=1cm,top=1.5cm,bottom=2.5cm]{geometry}
\definecolor{col4}{RGB}{72, 114, 198}
\definecolor{col1}{RGB}{32, 114, 98}
\definecolor{col2}{RGB}{32, 58, 95 }
\definecolor{col3}{RGB}{45, 85, 155}
\newcommand*\mycirc[1]{%
    \begin{tikzpicture}[baseline=(C.base)]
        \node[draw,circle,inner sep=1pt,minimum size=3ex](C) {#1};
\end{tikzpicture}}
\pagestyle{empty}
\usepackage[most,breakable]{tcolorbox}
\usetikzlibrary{shapes.arrows,calc}
\newtcolorbox{mybox}[1][]{%
    enhanced,interior code app={\fill[line width=1pt,col1] ( [yshift=-1cm]frame.north east)to[out=140,in=60]( [xshift=-2cm]frame.south east)--++(2cm,0)--cycle;},width=17.7cm,arc=0pt,outer arc=0pt ,colback=white,colframe=blue,
    frame code app={\fill[line width=0.2pt,col1]( frame.north west)rectangle (frame.south east);}
}
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtcolorbox[auto counter]{Exercice}[2][]{
enhanced,top=0.5cm,bottom=0.5cm,
overlay app={\draw[col1,line width=0.5cm] (frame.south west)--(frame.north west);
\node[rectangle,fill=violet,inner xsep=0.3cm, anchor=south east] at([xshift=-0.3cm]frame.north east){\textbf{\color{white}#1}};},
colback=white,colbacktitle=white,breakable,after=\vskip1cm,
fonttitle=\bfseries,coltitle=col1,colframe=col1,
attach boxed title to top left={xshift=0.5cm,yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
title={\textbf{Exercice n$^{\circ}$\thetcbcounter :}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\cir[1]{\tikz[baseline=(char.base)]{%
        \node[shape=circle,fill=col4,draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{white}#1};}}
\newcommand*\mycir[1]{\tikz[baseline=(char.base)]{%
        \node[shape=circle,fill=yellow, draw=col1,minimum size=0.6cm,inner sep=2pt] (char) {\color{col4}#1};}}
\usepackage{enumitem}
\begin{document}
\begin{Exercice}[Examen National $2015$ Normale]{}
Une urne $\mathbb{U}_{1}$ contient $7$ boules :  {\color{red} $4$ rouges} et  {\color{green} $3$ vertes} (indiscernables au toucher)
        
Une urne $\mathbb{U}_{2}$ contient $5$ boules :  {\color{red} $3$ rouges} et  {\color{green} $2$ vertes} (indiscernables au toucher)
\begin{flushleft}
\begin{tikzpicture}[circ/.style={draw,circle,inner sep=1pt,thick}]
\def\dis{.55}
\begin{scope}[local bounding box=L]
\path[nodes={circ}] 
(\dis,0) node{V}
(-\dis,0) node{R}
(0,0) node{V}
(\dis/2,-\dis) node{R}
(3*\dis/2,-\dis) node{R}
(-\dis/2,-\dis) node{V}
(-3*\dis/2,-\dis) node{R};
\end{scope}
\path
(L.east)+(1.5,0) node{urne $U_1$}
(L.north east)+(45:.2) coordinate (B)
(L.south west)+(-135:.2) coordinate (A)
;
\draw[thick] (B)|-(A)--(A|-B);  
\end{tikzpicture}   
\end{flushleft}
On considère l'expérience suivante : On tire au hasard et simultanément trois boules de l'urne $U_{1}$.
        
Soit l'événement $\mathcal{A}$ : "obtenir une boule {\color{red} rouge} et deux boules {\color{green} vertes}"
        
\hspace{0.25cm} et l'événement $\mathcal{B}$ : "obtenir trois boules de la même couleur"
        
        
\begin{flushleft}
\begin{tikzpicture}[circ/.style={draw,circle,inner sep=1pt,thick}]
\def\dis{.55}
\begin{scope}[local bounding box=L]
\path[nodes={circ}] 
(\dis,0) node{V}
(-\dis,0) node{R}
(0,0) node{R}
(\dis/2,\dis) node{R}
(-\dis/2,\dis) node{V}
;
\end{scope}
\path
(L.east)+(1.5,0) node{urne $U_2$}
(L.north east)+(45:.2) coordinate (B)
(L.south west)+(-135:.2) coordinate (A)
;
\draw[thick] (B)|-(A)--(A|-B);  
\end{tikzpicture}   
\end{flushleft}

On considère l'expérience suivante : On tire au hasard et en même temps deux boules de $\mathbb{U}_{1}$, puis on tire au hasard une boule de $\mathbb{U}_{2}$
        
Soit l'événement $\mathcal{C}$ : "obtenir trois boules {\color{red} rouges}"
        
\hspace{1cm} {\color{blue} $\Rightarrow$} Montrer que $P\left ( \mathcal{C} \right )=\frac{6}{35}$
\end{Exercice}
\end{document}

相关内容