I'm looking for a method to improve my current command:
\newcommand{\deq}[2][]{\begin{tcolorbox}[
colback = blizzardblue!30!white, colframe = white,
top = -0.3cm, bottom = 0.1cm]\begin{flalign}
\text{\bfseries #1} && #2 & &
\end{flalign}\end{tcolorbox}
}
that produces
What I want to improve is to be allowed to write a second title for the equation. Using a table, I get this:
but I couldn't find a way to center horizontally and vertically the equation. The code for the table is this:
\begin{tcolorbox}[
colback = blizzardblue!30!white, colframe = white]
\begin{tabularx}{\textwidth}{Lcr}
\bfseries Clausius's Theorem
& $\dps\sideset{_R}{}\oint \frac{\dbar Q}{T} = 0$ & \refstepcounter{equation}(\theequation) \\
\bfseries Part of the Second Law of Thermodynamics
\end{tabularx}
\end{tcolorbox}
I'm using this packages:
\usepackage[italicdiff]{physics}
\usepackage[scr = rsfso]{mathalfa}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{xcolor}
\definecolor{blizzardblue}{rgb}{0.4, 0.6, 0.8}
\usepackage{tcolorbox}
\tcbuselibrary{skins, breakable, hooks, theorems}
The best answer to the question must contain the equation centered (horizontally and vertically) and a command (like the one I wrote) to produce the table/environment with 3 arguments: #1 equation (mandatory) and, if it's possible, #2 primary title (optional) and #3 secundary title (optional). I don't know if this possible to have more than one optional argument. Thanks for reading and for you help!



\NewDocumentCommandinstead of\newcommand? It's better? – Peluche Feb 07 '23 at 14:19\newcommandis a limited way to define new commands. In general, you should prefer\NewDocumentCommandin all circumstances. Among other things, commands defined with\newcommandthat have optional arguments will break if they appear in any sectioning command. – Don Hosek Feb 07 '23 at 14:28