乳胶盒示例

乳胶盒示例

有人可以在 LaTeX 的示例代码中制作这张图片,并请用不同的颜色制作成不同的风格。 在此处输入图片描述

这是我的尝试:

\fbox{
  \parbox{\linewidth}{
     This example will show you how we can ..
     $dX_{t}=b(t,X_{t})+\sigma (t,X_{t}) dW_{t}$
     \begin{center}
       \begin{tabular}{ l | c || r } \hline
         W & S  \\ \hline
         + & -  \\ \hline
       \end{tabular}
     \end{center}
   }
}

答案1

这是创建您所寻找内容的开始:

\documentclass{article}
\usepackage{xcolor}
\usepackage{fancybox}
\pagestyle{empty}
\begin{document}

\noindent
\shadowbox{%
\begin{minipage}{\dimexpr\textwidth-\shadowsize-2\fboxrule-2\fboxsep}
   \textcolor{red}{\sffamily EXAMPLE 3.}\par\vspace{\baselineskip}

    \hspace*{\fill}
    %--------------------------%
    \setlength{\shadowsize}{2pt}
    \parbox{2in}{\shadowbox{$\displaystyle  dX_t = - \frac{1}{2X_t}I(X_t\not=)dt+dW_t$}}
    %--------------------------%
    \hspace*{\fill}
    %--------------------------%
    {\sffamily
    \begin{tabular}{|c|c|}\hline
     \textcolor{red}{W} & \textcolor{blue}{S} \\\hline
     $-$                & $-$                 \\\hline
    \end{tabular}}
    %-------------------------%
    \hspace*{\fill}\par\vspace{1ex}

\end{minipage}}

\end{document}

在此处输入图片描述

更新

如果您想给方框上色,我建议您查看mdframed@GonzaloMedina 给出的示例 --- 我不太熟悉这个包。您也可以考虑查看该包tcolorbox(也由 GonzaloMedina 说明),但它似乎也依赖于tikz包和库的捆绑包。

答案2

一种选择是使用tcolorbox

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shadows}

\newcounter{exa}

\tcbset{
myexample/.style={
  enhanced,
  colback=yellow!10!white,
  colframe=red!50!black,
  fonttitle=\scshape,
  titlerule=0pt,
  title={\refstepcounter{exa}example~\theexa.},
  title style={fill=yellow!10!white},
  coltitle=red!50!black,
  drop shadow,
  highlight math style={reset,colback=LightBlue!50!white,colframe=Navy}
  }
}

\newtcolorbox{texample}{myexample}

\begin{document}

\begin{texample}
\centering
\tcbhighmath{\textrm{d}X_{t}=b(t,X_{t})+\sigma (t,X_{t}) \textrm{d}W_{t}}\quad
\begin{tabular}{|c|c|}
\hline
\textcolor{red!70!black}{W} & \textcolor{Navy}{C} \\
\hline
$+$ & $-$ \\
\hline
\end{tabular}
\end{texample}

\end{document}

在此处输入图片描述

现在可以使用以下选项mdframedhf-tikz

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[customcolors]{hf-tikz}
\usetikzlibrary{shadows}

\newcounter{exa}

\newmdenv[
settings={\refstepcounter{exa}},
linewidth=1pt,
innertopmargin=1.5\baselineskip,
roundcorner=6pt,
backgroundcolor=yellow!10,
linecolor=red!70!black,
frametitle=example~\theexa,
frametitlefont=\scshape\color{red!70!black},
shadow=true
]{mdexample}

\begin{document}

\begin{mdexample}
\centering
\hfsetfillcolor{LightBlue!50}
\hfsetbordercolor{Navy}
\tikzmarkin{a}(0.3,0.6)(-0.3,-0.4)$\textrm{d}X_{t}=b(t,X_{t})+\sigma (t,X_{t}) \textrm{d}W_{t}$\tikzmarkend{a}\qquad
\begin{tabular}{|c|c|}
\hline
\textcolor{red!70!black}{W} & \textcolor{Navy}{C} \\
\hline
$+$ & $-$ \\
\hline
\end{tabular}
\end{mdexample}

 \end{document}

在此处输入图片描述

相关内容