\documentclass{article}
\usepackage{mathtools,amsfonts,amsmath,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcolorbox}[enhanced,boxrule = 1pt,
colframe = myLColor,
colback = red!80!black,
sharp corners,
rounded corners = southeast,
rounded corners = northeast,
rounded corners = southwest,
rounded corners = northwest,
arc is angular,
arc = 3mm,
coltext = white,attach boxed title to top center={xshift=3mm,yshift*=-\tcboxedtitleheight/2},
boxed title style={
colback=blue,
colframe=blue,
arc=3mm,
outer arc=3mm,
boxrule=0mm,
boxsep=0mm
},title=Lots of equations]
Let us consider
\begin{align}
f&=ma\\
T_{\mu\nu}&=G_{\mu\nu}
\end{align}
\end{tcolorbox}
\end{document}
有没有办法让这个框包含除方程式编号之外的所有内容。我希望方程式编号位于 tcolorbox 之外,而其他所有内容都位于框内。
可以这样做吗?
答案1
尝试一下extrude right by=<negative length>
:
\documentclass{article}
\usepackage{mathtools,amssymb,amsthm}
\usepackage[skins]{tcolorbox}
\colorlet{myLColor}{blue!50}
\newtagform{enforce black}[]{\begingroup\normalcolor(}{)\endgroup}
\usetagform{enforce black}
\begin{document}
\begin{tcolorbox}[title=Normal box]
Let us consider
\begin{align}
f&=ma\\
T_{\mu\nu}&=G_{\mu\nu}
\end{align}
\end{tcolorbox}
\begin{tcolorbox}[enhanced,
boxrule = 1pt,
colframe = myLColor,
colback = red!80!black,
arc is angular,
arc = 3mm,
coltext = white,
attach boxed title to top center={
xshift=3mm,
yshift*=-\tcboxedtitleheight/2
},
boxed title style={
colback=blue,
colframe=blue,
arc=1.5mm, % reduced
outer arc=2mm, % reduced
boxrule=0mm,
boxsep=0mm
},
title=Lots of equations,
extrude right by=-1.5cm % << added
]
Let us consider
\begin{align}
f&=ma\\
T_{\mu\nu}&=G_{\mu\nu}
\end{align}
\end{tcolorbox}
\end{document}
注意
extrude right by
不适用于 tcolorbox 可破坏盒子,请参阅包装手册开头的标记,第 4.15.5 节“盒子挤压”。- 除方程式标签之外的任何超出框右边距的框内容仍然是不可见的(白底白色)。