1

How to call the content of \tcbitem of tcbitemize environment in tcolorbox in its option part. Example code like this:

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

\begin{document}
\tcbset{figure/.style={...} % or figure/.code
\begin{tcbitemize}
  \tcbitem[figure] myfigure.jpg % This will typeout a figure as the content of this \tcbitem
\end{tcbitemize}

\end{document}
1

1 Answer 1

1

If you want to type less, just create a macro (here I've called it \myinc):

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

\newcommand{\myinc}[1]{\includegraphics[width=\textwidth]{#1}}

\begin{document}
\begin{tcbitemize}
  \tcbitem \myinc{example-image-a.jpg} 
  \tcbitem \myinc{example-image-b.jpg}
\end{tcbitemize}
\end{document}

enter image description here

2
  • Thank you @CarLa. I konw the way to add a figure as shown in your answer. Yet this is not convinient(many letters input for just insert a figure). I'm looking for a way by which a predesined style is used to complete the job as shown in my example code.
    – lyl
    Nov 1, 2018 at 0:33
  • @lyl See my renewed answer
    – CarLaTeX
    Nov 1, 2018 at 6:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .