how to use standalone class with option [multi=tcolorbox]?

Not exactly a solution, but it works.

\documentclass[multi=wrapper,crop]{standalone}
\usepackage{tcolorbox}
\usepackage{lipsum}

\newenvironment{wrapper}{}{}

\begin{document}

\begin{wrapper}
\begin{tcolorbox}
\lipsum[1]  
\end{tcolorbox}
\end{wrapper}

\begin{wrapper}
\begin{tcolorbox}
\lipsum[1-2]  
\end{tcolorbox}
\end{wrapper}

\end{document}

Welcome! Here is an alternative way to make each tcolorbox as separate page. It does not use the standalone class, though.

\documentclass{article}
\usepackage[active,tightpage]{preview}
\usepackage{tcolorbox}

\usepackage{lipsum}
\tcbset{before=\begin{preview},after=\end{preview}}
\begin{document}

\begin{tcolorbox}
\lipsum[1]  
\end{tcolorbox}

\begin{tcolorbox}
\lipsum[1-2]  
\end{tcolorbox}

\end{document}

enter image description here

The trick is to automatically wrap the tcolorbox in a preview environment via

 \tcbset{before=\begin{preview},after=\end{preview}}

This trick may be combined with John Kormylo's nice answer to get

\documentclass[multi=wrapper,crop]{standalone}
\usepackage{tcolorbox}
\usepackage{lipsum}

\newenvironment{wrapper}{}{}
\tcbset{before=\begin{wrapper},after=\end{wrapper}}

\begin{document}

\begin{wrapper}
\begin{tcolorbox}
\lipsum[1]  
\end{tcolorbox}
\end{wrapper}

\begin{wrapper}
\begin{tcolorbox}
\lipsum[1-2]  
\end{tcolorbox}
\end{wrapper}

\end{document}

Tags:

Standalone