tcolorbox 具有双色,但只有右框有轮廓

tcolorbox 具有双色,但只有右框有轮廓

我如何使用来创建以下内容tcolorbox

在此处输入图片描述

每次我尝试,我能得到的最好的结果就是:

在此处输入图片描述

梅威瑟:

    \documentclass[12pt]{article}

\usepackage[many]{tcolorbox}
\usepackage{tikz}
\usepackage[margin=2cm,includefoot,bottom=2.55cm,top=2.025cm,headsep=0.5cm,footskip=0.65cm]{geometry}

\definecolor{myblue}{RGB}{0,46,142}
\newtcolorbox[auto counter]{mytheorem}[1][]{
  enhanced jigsaw,colback=white,colframe=myblue,coltitle=myblue,
  fonttitle=\bfseries,
  sharp corners,
  detach title,
  leftrule=18mm,
  underlay unbroken and first={\node[above,text=white,font=\bfseries,align=center]
    at ([xshift=-9mm,yshift=0mm]interior.west) {\thetcbcounter};},
  breakable,pad at break=1mm,
  #1,
  code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}

\begin{document}\raggedright

  \begin{mytheorem}[title=Important Note]
    Important content. A body remains in a state of rest or continuous uniform motion unless acted on by an unbalanced external force.
      \begin{align*}
        45x^2-4x  & =75x
        \end{align*}
  \end{mytheorem}


\end{document}

还想知道如何将箱子编号放在其列的中心,或者放在与标题一致的列顶部。

非常感谢

答案1

我不会增加规则宽度,而是增加左边距并将数字放在那里。

\documentclass[12pt]{article}

\usepackage[many]{tcolorbox}
\usepackage[%
    margin=2cm,
    includefoot,
    bottom=2.55cm,
    top=2.025cm,
    headsep=0.5cm,
    footskip=0.65cm
]{geometry}

\definecolor{myblue}{RGB}{0,46,142}

\newtcolorbox[auto counter]{mytheorem}[1][]{%
    enhanced jigsaw,
    colback=white,
    colframe=myblue,
    coltitle=myblue,
    fonttitle=\bfseries,
    sharp corners,
    detach title,
    enlarge left by=18mm,
    width=\linewidth-18mm,
    underlay unbroken and first={%
       \node[above,text=myblue,font=\bfseries,align=center] at ([xshift=-.5\textwidth,yshift=-7mm]interior.north) {\thetcbcounter};
    },
    breakable,
    pad at break=1mm,
    #1,
    code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}

\begin{document}\raggedright

  \begin{mytheorem}[title=Important Note]
    Important content. A body remains in a state of rest or continuous uniform motion unless acted on by an unbalanced external force.
      \begin{align*}
        45x^2-4x  & =75x
        \end{align*}
  \end{mytheorem}


\end{document}

在此处输入图片描述

相关内容