是否可以在 tcolorbox 中更改 \tbclower 的背景颜色?

是否可以在 tcolorbox 中更改 \tbclower 的背景颜色?

我一直用它tcolorbox来显示公式这是我正在使用的代码

\documentclass{article}
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins}

\newtcolorbox[auto counter]{formula}{
before=\centering\bigskip,
after=\bigskip,
enhanced,
width=.65\linewidth,
colback=orange!30,
fonttitle=\sffamily\bfseries\Large,
title=Fórmula~\thetcbcounter,
arc=15pt,
colupper=black,
fontupper=\sffamily\bfseries,
height=2.5cm,
valign=center,
top=-2mm
sharp corners,
sidebyside,
lower separated=false,
rounded corners=south,
attach boxed title to top center={yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=-0.25mm-\tcboxedtitleheight/2},
boxed title style={
    enhanced,
    colframe=red,
    colback=orange,
    arc=5pt,
},
frame style={
    left color=red,
    right color=orange,},}

\begin{document}

\begin{formula}
\centering
Slope of a line given two points
\tcblower
$$m=\dfrac{y_{2}-y_{1}}{x_{2}-x_{1}}$$
\end{formula}

\end{document}

这给了我以下框

我个人认为,如果下部有白色背景会更好,但我在tcolorbox 手册

在此处输入图片描述

答案1

使用该skin=bicolor选项。这将启用该colbacklower键,然后可以将其设置为任何颜色规范。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}
%\tcbuselibrary{skins}

\newtcolorbox[auto counter]{formula}{%
  enhanced,
  skin=bicolor,
  before=\centering\bigskip,
  after=\bigskip,
  width=.65\linewidth,
  colback=orange!30,
  fonttitle=\sffamily\bfseries\Large,
  title=Fórmula~\thetcbcounter,
  arc=15pt,
  colupper=black,
  fontupper=\sffamily\bfseries,
  height=2.5cm,
  valign=center,
  top=-2mm,
  sharp corners,
  sidebyside,
  lower separated=true,
  rounded corners=south,
  attach boxed title to top center={yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=-0.25mm-\tcboxedtitleheight/2},
  boxed title style={%
    enhanced,
    colframe=red,
    colback=orange,
    arc=5pt
  },
  frame style={%
    left color=red,
    right color=orange},
  colbacklower=white
}

\begin{document}

\begin{formula}
\centering
Slope of a line given two points
\tcblower
\[m=\dfrac{y_{2}-y_{1}}{x_{2}-x_{1}}\]
\end{formula}

\end{document}

在此处输入图片描述

相关内容