I am wondering how prooftree can work with colorbox? I've seen people shading their proof trees, but I am not certain what package people use. In my case, I use bussproofs, and it doesn't seem to work well with colorbox:

\documentclass{article}
\usepackage{bussproofs}
\usepackage{xcolor}

\begin{document}

\colorbox{gray}{
\begin{prooftree}
\AxiomC{some law...}
\end{prooftree}
}

\end{document}


The code above fails. I've searched around, but the answers are either about adding color, or using bussproofs, but not both. How should I shade the whole proof tree in a box?

with label:

\documentclass{article}
\usepackage{bussproofs}
\usepackage{tcolorbox}
\usepackage{framed}
\usepackage{multicol}

\begin{document}

\begin{multicols}{3}
\begin{tcolorbox}
\begin{prooftree}
\AxiomC{some law...}
\RightLabel{Label}
\UnaryInfC{Some Conclusion}
\end{prooftree}
\end{tcolorbox}

\end{multicols}

\end{document}


The box does not strictly include the label.

You can use the tcolorbox package:

\documentclass{article}
\usepackage{bussproofs}
\usepackage{xcolor}
\usepackage{tcolorbox}
\begin{document}

\begin{tcolorbox}
\begin{prooftree}
\AxiomC{some law...}
\end{prooftree}
\end{tcolorbox}

\end{document}


• thanks. but it seems somehow the box just doesn't want to include the label as well. is there any way out? – Jason Hu Oct 7 '18 at 19:19
• @HuStmpHrrr Sorry, I don't understand. There's no label even if the tcolorbox is removed. – Alan Munn Oct 7 '18 at 19:32
• I have labels in my actual proof trees. I've updated with an example. the problem is the box does not always include the label. I think the box wraps the region with margin, but isn't really aware of the widgets included in it. is it the case? – Jason Hu Oct 7 '18 at 21:49
• @HuStmpHrrr The problem is that your proof is wider than the column width. This is no different than when you have a tabular that extends outside of the page. So you need to make two columns instead of 3 in your example. You can also add an explicit [width= ... ] option after \begin{tcolorbox} to manually set the width of the box, although I suspect this shouldn't be needed. See the tcolorbox documentation for more details. – Alan Munn Oct 7 '18 at 22:01