53

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.

3
  • 1
    I remember Marco Daniel saying that tcolorbox is more advanced than mdframed. My memory may bad though. Kindly excuse if I am wrong.
    – user11232
    Oct 1, 2013 at 2:05
  • related: framed or mdframed? (Pros/Cons)
    – cgnieder
    Oct 2, 2013 at 8:54
  • 2
    Very interested in an answer to this question as well.
    – Ingo
    Oct 21, 2013 at 9:22

3 Answers 3

39
+500

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

1
  • 1
    Actually, like tikz, the tcolorbox package relies on pgf, a lower level framework. But Tikz support can be loaded as a library.
    – mhelvens
    Oct 22, 2013 at 0:46
7

For what it's worth: I've been using mdframed for quite a while… I didn't know tcolorbox existed! After browsing the tcolorbox documentation for a couple of minutes, I'm itching to convert my documents.

It seems to me like an extremely well-crafted package. It is natively based on pgf, and uses pgfkeys properly to provide its own range of options, which is to me a mark of quality. It also offers a suite of libraries to extend functionality, such as full tikz support.

In contrast, the mdframed interface has always felt a bit clumsy and frustrating to me. And support for custom TikZ options seems to be 'tacked on', rather than properly implemented. In addition, I've had it conflict with other packages on more than one occasion.

2

I read little doc about tcolorbox, and some doc on mdframed, i mainly use mdframed for my environments. In my opinion, one can change frameline with mdframed using tikz/pgf easily, there are many illustrations on stackexchange given by Gonzalo Medina and someone else. As for tcolorbox, it seems that there is little example code, but the tcolorbox's documentation is very beautifully made.

2
  • Also tcolorbox allows to easily change the so called skin with custom TikZ/PGF frames. Oct 2, 2013 at 8:47
  • i have changed my mind, tcolorbox is flexible Dec 9, 2013 at 12:52

You must log in to answer this question.

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