![一个盒子套着另一个盒子](https://linux22.com/image/434445/%E4%B8%80%E4%B8%AA%E7%9B%92%E5%AD%90%E5%A5%97%E7%9D%80%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%9B%92%E5%AD%90.png)
我尝试将一个框(红色框)放入另一个框(黄色框)内,但是这样做时红色框会失去其颜色格式。
这是我的代码:
\begin{ejemplo}
$ {{e^{x}=(1+e^{x})yy^{\prime}}}$\\
\textbf{PASO 1.} Ordenando en la forma general $ M(x,y)dx+N(x,y)dy=0 $.
\begin{equation*}
e^{x}-(1+e^{x})y\dfrac{dy}{dx}=0
\end{equation*}
\begin{equation*}%
e^{x}dx-(1+e^{x})y{dy}=0
\end{equation*}
\textbf{PASO 2.} Identificando el tipo de ecuación
\begin{equation*}
\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-ydy=0\quad m/m\int\quad\Rightarrow \text{E.D.O. Variables separables}
\end{equation*}
\begin{minipage}{10cm}
\textbf{PASO 3.} resolviendo la E.D.O.
\begin{equation*}%
\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-y{dy}=0\: [m/m]\int
\end{equation*}
\begin{equation*}%
\int\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-\int y{dy}=\int 0
\end{equation*}
\begin{center}
\fcolorbox{yellow}{yellow}{ \color{black} $ \ln\left(1+e^{x}\right)-\dfrac{y^{2}}{2}=c$}
\end{center}
\end{minipage}
\begin{minipage}{5cm}
\tcbset{
enhanced,
colback=red!5!white,
boxrule=0.1pt,
colframe=red!75!black,
fonttitle=\bfseries
}
\begin{tcolorbox}[title=Cálculo auxiliar,center title,hbox, %%<<---- here
lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%
{black!50!white}]
\begin{varwidth}{\textwidth}
\begin{equation*}
\int\dfrac{e^{x}}{\left(1+e^{x}\right)} =\int\dfrac{dt}{t}
\end{equation*}
\begin{equation*}
\left\{ \begin{array}{rc}
t &=1+e^{x} \\
dt & =e^{x}dx \\
\end{array}\right.=\ln\left(1+e^{x} \right)
\end{equation*}
\end{varwidth}
\end{tcolorbox}
\end{minipage}
\end{ejemplo}
答案1
您没有提供完整的 MWE(ejemplo
环境如何定义?),因此很难回答。
我希望这有帮助。
\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{array}
\usepackage{varwidth}
\usepackage[all]{tcolorbox}
\newtcolorbox{ejemplo}[2][]{enhanced,
attach boxed title to top left={yshift*=3mm-\tcboxedtitleheight},
boxed title style={fonttitle=\bfseries},
breakable,
title={#2},#1}
\newtcolorbox{boxinbox}[2][]{
enhanced,
colback=red!5!white,
boxrule=0.1pt,
colframe=red!75!black,
fonttitle=\bfseries,
center title,
width=.4\linewidth,
nobeforeafter,
lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%
{black!50!white},
title={#2},
#1
}
\begin{document}
\begin{ejemplo}{Ejemplo}
$ {{e^{x}=(1+e^{x})yy^{\prime}}}$\newline
\textbf{PASO 1.} Ordenando en la forma general $ M(x,y)dx+N(x,y)dy=0 $.
\begin{equation*}
e^{x}-(1+e^{x})y\dfrac{dy}{dx}=0
\end{equation*}
\begin{equation*}%
e^{x}dx-(1+e^{x})y{dy}=0
\end{equation*}
\textbf{PASO 2.} Identificando el tipo de ecuación
\begin{equation*}
\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-ydy=0\quad m/m\int\quad\Rightarrow \text{E.D.O. Variables separables}
\end{equation*}
\textbf{PASO 3.} resolviendo la E.D.O.
\begin{center}
\begin{minipage}[b]{.4\linewidth}
\begin{equation*}%
\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-y{dy}=0\: [m/m]\int
\end{equation*}
\begin{equation*}%
\int\dfrac{e^{x}}{\left(1+e^{x}\right)}dx-\int y{dy}=\int 0
\end{equation*}
\begin{center}
\fcolorbox{yellow}{yellow}{ \color{black} $ \ln\left(1+e^{x}\right)-\dfrac{y^{2}}{2}=c$}
\end{center}
\end{minipage}
\begin{boxinbox}{Cálculo auxiliar}
\begin{equation*}
\int\dfrac{e^{x}}{(1+e^{x})} =\int\dfrac{dt}{t}
\end{equation*}
\begin{equation*}
\left\{ \begin{array}{rc}
t &=1+e^{x} \\
dt &=e^{x}dx \\ \end{array}\right. =\ln(1+e^{x})
\end{equation*}
\end{boxinbox}
\end{center}
\end{ejemplo}
\end{document}