tcolorbox 中易碎 - 它不会破碎

tcolorbox 中易碎 - 它不会破碎

2020 年 3 月 21 日更新

\documentclass[12pt,a4paper,UTF8]{report}
%%
\usepackage{CJKutf8}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry}
%%
%% Header and Footer
\usepackage{fancyhdr}
\usepackage{lastpage}
%%
%% Figures and Graphs
\usepackage{adjustbox}
\usepackage{subfigure,float}
%\usepackage{graphicx,xcolor,subfigure,float}% for pictures
\graphicspath{{./Pictures/}}
%% Font
\usepackage[T1]{fontenc}
\usepackage[default,angular]{comicneue}
%% QR code for classroom
\usepackage{qrcode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\theoremstyle{plain}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{remark}{Remark}[section]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse,breakable}
\tcbset{%
    colback=white,
    tikz={opacity=1,transparency group},
    colframe=black,
%   breakable,
    title filled=false,
%   bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
    auto counter,
    number within=section
    ]{example}{ +O{}mo }{%
    fonttitle    = \bfseries,
    title        = {Example~\thetcbcounter:~ #2},
    before lower = {\textbf{Solution~\thetcbcounter:\quad}},
%   lowerbox     = invisible, %invisible/ignored
% after title/after upper
    IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
    #1
}%



\usepackage{hyperref}
\begin{document}

\graphicspath{{./Pictures/bino_dist/}}



\begin{example}{Symmetry of binomial distribution}
A bag contains a large number of red and white discs, of which $85\%$ are red. 
$20$ discs are taken from the bag. 
Find the probability that the number of red discs lies between $12$ and $17$ inclusive.
\tcblower 
%%%%% 
%%%%% Let $X$ be the number of red discs. So $X \sim B(20,0.85)$. We want
\begin{equation}
    P(12 \leq X \leq 17) = P(X \leq 17) - P(X \leq 11)
\end{equation}
Then we notice that the table only gives the probabilities for $p$ up to 0.5. 
We have to go back to Figure~\ref{fig:bino-pdf} and think about using symmetry of the Binomial distribution.\\
%%%%% 

Let $Y$ be the number of white discs and $Y \sim B(20,0.15)$. So we have
\begin{align}
    P(12 \leq X \leq 17)
    &=
    P( 3 \leq Y \leq  8) \\
    &=
    P(Y \leq 8) - P(Y \leq 2) \\
    &=
    0.9987-0.4049 \\
    &=
    0.5938
\end{align}



The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.
%%
%%
The blue lines are ``probability'' of interest. 
The graphs on the left are the full plot of the distribution, where the graphs on the right are zoomed in on the area of interest. 
The top row represents the $X \sim B(20,0.85)$ distribution and the bottom row represents the $Y \sim B(20,0.15)$ distribution.


\end{example}





\cleardoublepage
%\renewcommand{\CoverName}{Back Cover}
%\renewcommand{\thepage}{\CoverName}
\thispagestyle{empty}
\centering
\mbox{}
\vfill
\huge{[This page is intentionally left blank.]
\vfill

\end{document}

请参阅这个新的 MWE,在这个文件中,我采纳了将 放入的建议breakabletcbset但如果我使用它,当有框中的内容太多,它会出错,不会产生任何内容。如果没有breakabletcbset它会编译,但不会破坏内容。

OP

\documentclass[12pt,a4paper,UTF8]{report}  
\usepackage{amsmath,enumerate}
\usepackage[top=1cm, left=1.5cm, right=1.5cm, bottom=1.5cm]{geometry}
\usepackage[unicode]{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse,breakable}
\tcbset{%
    colback=white,
    tikz={opacity=0.1,transparency group},
    colframe=black,
    title filled=false,
%   bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
    auto counter,
    %number within=section
    ]{example}{ +O{}mo }{%
    fonttitle    = \bfseries,
    title        = {Example~\thetcbcounter:~ #2},
    before lower = {\textbf{Solution~\thetcbcounter:\quad}},
%   lowerbox     = invisible, %invisible/ignored
% after title/after upper
    IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
    #1
}%

%%
%% FIX FLOATS
%\makeatletter
%\newenvironment{fixedfigure}
%   {\def\@captype{figure}\center}
%   {\endcenter}
%\makeatother
%%
%% find the float
%%
%\makeatletter
%\let\old@error\@latexerr
%\def\zzfl@error{Float(s) lost}
%
%\def\@latexerr#1{%
%\def\tmp{#1}%
%\ifx\tmp\zzfl@error
%  \def\@elt##1{{%
%   \let \protect\noexpand
%    \shipout\vbox{\hbox{LOST FLOAT}\hbox{\fbox{\box##1}}}}}%
%  \@currlist\@dbltoplist 
%  \let\@elt\relax
%\fi
%\old@error{#1}}
%\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%







\begin{document}

\section*{Finding the PDF of a function of a continuous random variable}
% [lowerbox = invisible]
\begin{example}[lowerbox = invisible]{}
The continuous random variable $X$ has PDF $\mathrm{f}(x)$ given by
\[
    \mathrm{f}(x)
    =
    \begin{cases}
        4x^3 & 0 \leq x \leq 1 \\
        0 & \text{otherwise}
    \end{cases}
\]
\begin{enumerate}[(a)]
\item Find $\mathrm{F}(x)$.
\item The continuous random variable $Y$ is given by $Y=X^3$. 
The cumulative distribution function of $Y$ is denoted by $\mathrm{H}(y)$. 
Find $\mathrm{H}(y)$.
\item Find $\mathrm{h}(y)$.
\item Find $\mathrm{P}(X<0.5)$.
\item Find $\mathrm{P}(Y<0.5)$.
\end{enumerate}
%%
%%
\tcblower
%%
%%
\begin{enumerate}[(a)]
\item
    \[
        \mathrm{F}(x)
        =
        \int_0^x 
        4s^3 \, \mathrm{d}s
        =
        x^4.
    \]
    Hence
    \[
        \mathrm{F}(x)
        =
        \begin{cases}
            0 & x<1 \\
            x^4 & 0 \leq x \leq 1 \\
            1 & x>1
        \end{cases}
    \]
\item
    \[
        \begin{aligned}
        \mathrm{H}(y) 
        &= \mathrm{P}(Y \leq y) \\
        &= \mathrm{P}(X^3 \leq y) \\
        &= \mathrm{P}(X \leq y^{\frac13}) \\
        &= (y^{\frac13})^4 \\
        &= y^\frac43
        \end{aligned}
    \]
    Hence
    \[
        \mathrm{H}(y)
        =
        \begin{cases}
            0         &  y<1 \\
            y^\frac43 &  0 \leq y \leq 1 \\
            1         &  y>1
        \end{cases}
    \]
\item
    \[
        \mathrm{h}(y)
        =
        \frac{\mathrm{d}}{\mathrm{d}y} \mathrm{H}(y)
        =
        \frac{4}{3}y^{\frac13}
    \]
    \[
        \mathrm{h}(y)
        =
        \begin{cases}
            \frac{4}{3}y^{\frac13} & 0 \leq y \leq 1 \\
            0                      & \text{otherwise}
        \end{cases}
    \]
\item
    \[
        \mathrm{P}(X<0.5)
        =
        \mathrm{F}(0.5)
        =
        0.5^4
        =
        \frac{1}{16}.
    \]
\item
    \[
        \mathrm{P}(Y<0.5)
        =
        \mathrm{H}(0.5)
        =
        0.5^\frac43
        =
        0.39685
    \]
\end{enumerate}
%%
%%
More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text More text 
\end{example}




\begin{example}{}
The continuous random variable $X$ has PDF $\mathrm{f}(x)$ given by
\[
    \mathrm{f}(x)
    =
    \begin{cases}
        2(1-x) & 0 \leq x \leq 1 \\
        0 & \text{otherwise}
    \end{cases}
\]
The continuous random variable $Y$ is given by $Y=(1-X)^2$.
\begin{enumerate}[(a)]
\item Find $\mathrm{h}(y)$, the probability density function of $Y$ and name the distribution that it represents.
\item Find $\mathrm{P}(X<0.9)$.
\item Find $\mathrm{P}(Y<0.9)$.
\end{enumerate}
%%
%%
\tcblower
%%
%%
\begin{enumerate}[(a)]
\item
    \[
        \mathrm{F}(x)
        =
        \int_0^x 
        2(1-x) \, \mathrm{d}s
        =
        2x-x^2
        =
        \begin{cases}
            0      & x<1 \\
            2x-x^2 & 0 \leq x \leq 1 \\
            1      & x>1
        \end{cases}
    \]
    \[
        \begin{aligned}
        \mathrm{H}(y)
        =
        \mathrm{P}(Y \leq y)
        =
        \mathrm{P}( (1-X)^2 \leq y)
        =
        1-\mathrm{P}(X \leq 1-\sqrt{y})
        =
        y
        \end{aligned}
    \]
    Hence
    \[
        \mathrm{H}(y)
        =
        \begin{cases}
            0 &  y<1 \\
            y &  0 \leq y \leq 1 \\
            1 &  y>1
        \end{cases}
    \]
    So
    \[
        \mathrm{h}(y)
        =
        \begin{cases}
            1 &  0 \leq y \leq 1 \\
            0 &  \text{otherwise}
        \end{cases}
    \]
    $Y$ is a uniform distribution on $[0,1]$, that is $Y \sim U(0,1)$.
\item
    \[
        \mathrm{P}(X<0.9)
        =
        \mathrm{F}(0.9)
        =
        0.99
    \]
\item
    \[
        \mathrm{P}(Y<0.9)
        =
        \mathrm{H}(0.9)
        =
        0.9
    \]  
\end{enumerate}
%%
%%
\end{example}


\end{document}

查看盒子的输出,即使启用了该选项,它似乎也根本无法破坏\tcbuselibrary{skins,xparse,breakable}

如果我注释掉第一个例子中的最后文本,则该框会像这样进入页脚。 在此处输入图片描述

相关内容