[Tex/LaTex] What are the relative strong and weak points between tcolorbox and mdframed

mdframedtcolorbox

I think practically we will not use both tcolorbox and mdframed in a single input file. Correct me if I am wrong. So we have to choose either tcolorbox or mdframed. However, without knowing the strong and weak points of both, we can only choose one by gambling.

Shortly speaking, what are the weak and strong points of both packages? The answers really influence the path of my life in TeX.

Best Answer

I have the understanding that tcolorbox capabilities are a superset of mdframed. While mdframed tries to give you tools to create colorful frames, they look pale and simpler to me comparing to tcolorbox ones.

I think with enough tikz ninja skills you can achieve pretty much what you want with both, but somehow the tcolorbox syntax and options are simpler to me.

Also, tcolorbox has this "upper part/lower part" capabilities that mdframed lacks and creating a simple colored frame with a title seems simpler with tcolorbox.

From the documentation of mdframed

\mdfdefinestyle{theoremstyle}{%
linecolor=red,middlelinewidth=2pt,%
frametitlerule=true,%
apptotikzsetting={\tikzset{mdfframetitlebackground/.append style={%
shade,left color=white, right color=blue!20}}},
frametitlerulecolor=green!60,
frametitlerulewidth=1pt,
innertopmargin=\topskip,
}
\mdtheorem[style=theoremstyle]{definition}{Definition}
\begin{definition}[Inhomogeneous linear]
\ExampleText
\end{definition}
\begin{definition*}[Inhomogeneous linear]
\ExampleText
\end{definition*}

mdframed theorem

the equivalent in tcolorbox documentation:

\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}%
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}

\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number. This theorem is numbered with
\ref{th:theoexample} and is given on page \pageref{th:theoexample}.
\end{mytheo}

tcolorbox theorem

@claudio-fiandrino mentioned that mdframe boxes can be customized with tikz. This is also the case with tcolorbox, since it relies on tikz.

\tcbset{colback=Salmon!50!white,colframe=FireBrick!75!black, width=(\linewidth-8mm)/2,before=,after=\hfill,equal height group=ske}
\begin{tcolorbox}[adjusted title=My title]
This is my content.
\end{tcolorbox}
\begin{tcolorbox}[skin=beamer,beamer,adjusted title=My title]
This is my content.
\end{tcolorbox}

tcolorbox customization

Related Question