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

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

| improve this answer | |
  • 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 '18 at 0:33
  • @lyl See my renewed answer – CarLaTeX Nov 1 '18 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.