# Why does this code need the tcolorbox package?

Why does this code need the tcolorbox package to compile?

\documentclass[]{article}

\usepackage[most]{tcolorbox}

\def\Image{\includegraphics[scale=0.2]{example-image.jpg}}

\begin{document}

\foreach \i in {1,...,2}{
\Image
\newpage
}

\end{document}

• well you need pgffor for the \foreach, and graphicx for the graphic. Side remark: don't use only \def, you don't know if you redefine an important command with it. Use \newcommand, either instead or before the \def. Sep 6, 2020 at 12:38

As Ulrike Fischer told, what you need is pgffor and graphicx packages. This is the minimal code.

\documentclass[]{article}

\usepackage{pgffor}
\usepackage{graphicx}

\def\Image{\includegraphics[scale=0.2]{example-image.jpg}}

\begin{document}

\foreach \i in {1,...,2}{
\Image
\newpage
}

\end{document}


But tcolorbox loads pgf package which loads graphicx and pgffor and allows to compile your code. If you want to work with tcolorbox your code is correct, but it will load too much code for your example.