[Tex/LaTex] Itemize inside Tcolorbox

itemizetcolorbox

In the following MWE (Minimal Working Example), an Itemize is placed outside of a Tcolorbox, which compiles fine:

\documentclass{article}
\usepackage[breakable]{tcolorbox}

\makeatletter
\newcommand{\quoted}[1]{%
\setbox0=\hbox{#1}%
\setlength{\@tempdima}{\dimexpr\wd0+0pt}%
\setlength{\parindent}{50pt}%
\begin{tcolorbox}[breakable]%
#1%
\end{tcolorbox}%
}

\begin{document}
\begin{itemize}
\item Item1
\item Item2
\end{itemize}
\quoted{Here is some text inside a tcolorbox-environment, called for with the arbitrary name `quoted'.}
\end{document}

In the following MFE (Minimal Frustrating Example), an Itemize is placed inside of a Tcolorbox, which doesn't compile:

\documentclass{article}
\usepackage[breakable]{tcolorbox}

\makeatletter
\newcommand{\quoted}[1]{%
\setbox0=\hbox{#1}%
\setlength{\@tempdima}{\dimexpr\wd0+0pt}%
\setlength{\parindent}{50pt}%
\begin{tcolorbox}[breakable]%
#1%
\end{tcolorbox}%
}

\begin{document}
\quoted{Here is some text inside a tcolorbox-environment, called for with the arbitrary name `quoted'.
\begin{itemize}
\item Item1
\item Item2
\end{itemize}}
\end{document}

How to make an Itemize placed inside of a Tcolorbox please?

Best Answer

I am not certain if your extra code is because you want to do something really clever or because you are making it harder than it needs to be. I'm lumping for the second possibility right now.

\documentclass{article}
\usepackage{tcolorbox,lipsum}

\newcommand\zzz[1]{%
\begin{tcolorbox}
#1
\end{tcolorbox}
}

\newcommand\xxx[1]{%
\begin{tcolorbox}
  \begin{itemize}
 #1
  \end{itemize}
\end{tcolorbox}
}

\begin{document}

\zzz{\lipsum[1]}

\zzz{\lipsum[1]
  \begin{itemize}
  \item Lorem ipsum
  \end{itemize}
}

\xxx{%
\item One
\item Two
}

\end{document}
Related Question