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?
#1
twice? – jon Apr 17 '16 at 2:34\newcommand{\quoted}[1]
. This means that where you have#1
in the remainder of the definition, it will be replaced by what you include as the mandatory argument of the command\quoted
. So, because you have#1
twice, the command (as used here)\quoted{this is the replacement text}
tells TeX that you want to usethis is the replacement text
twice: once in your\hbox
and once inside yourtcolorbox
environment. – jon Apr 17 '16 at 2:50