[Tex/LaTex] Normal body text within tcolorbox

tcolorbox

Minimal example:

\documentclass{report}
\usepackage{tcolorbox}
\usepackage{lipsum}

\begin{document}

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

\end{document}

I want the paragraphs in the tcolorbox to be formatted like body text. (I'm using tcolorboxes as subsections.)

Best Answer

This is a consequence of the fact that LaTeX clears the paragraph indentation in a minipage or \parbox. But it's possible to tell tcolorbox to reapply it.

\documentclass{report}
\usepackage{tcolorbox}
\usepackage{lipsum}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\tcbset{before upper={\setlength{\parindent}{\normalparindent}}}

\begin{document}

\lipsum[1-2]

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

\end{document}

enter image description here