0
\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}

Is there a way to have this box contains everything but not the equation numbers. I would like the equation numbers to be outside of the tcolorbox but everything else inside the box.

Is it possible to do so?

4
  • @JohnKormylo I updated with article class.
    – user824530
    Apr 2 at 23:27
  • 1
    Your tcolorbox uses red!80!black as background color and white as foreground color. What colors do you expect for the equation numbers outside of the box? Apr 2 at 23:59
  • @muzimuzhiZ black like you have is perfect.
    – user824530
    Apr 3 at 1:00
  • Should the title of the tcolorbox be centered on the box width, or on the full text width? In the answers so far, it's closer to the center of the page than to the center of the box width. Apr 3 at 2:17

1 Answer 1

5

An extrude right by=<negative length> attempt:

\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}

enter image description here

Note that

  • extrude right by doesn't work with tcolorbox breakable boxes, see the marker at the beginning of package manual, sec. 4.15.5 "Box Extrusion".
  • Any box content except for equation tags exceeding the right margin of box is still invisible (white on white).
2
  • To have equation tags inside and outside of tcolorbox vertically aligned, one may check oversize option. Apr 5 at 2:54
  • Nice suggestion
    – MadyYuvi
    Apr 5 at 3:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .