0

I'm facing an issue i can't solve by my own : i'm trying to make a tcolorbox with an image and a text inside. I would like to change the text alignment to center it

mwe :

\documentclass{article}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage[skins,theorems]{tcolorbox}
\usepackage{mwe}

\newtcbox{\important}{enhanced,on line, colframe=red,colback=red!5!white, box align=center, boxrule=0.5pt,arc=4pt,boxsep=0pt,left=6pt,right=6pt,top=6pt,bottom=6pt}

\newcommand{\appel}{\begin{center} \important{\includegraphics[scale=0.07]{image} Here you write the text }\end{center}}

\begin{document}

\appel

\end{document}

It's probably easy but i can't figure how to change it -_- I've probably tried some stupid things in my /newtcbox lol

ThomProf
  • 13
  • 3

1 Answers1

-1

With thanks to @GonzaloMedina at

Alignment of image in tcolorbox

enter image description here

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\usetikzlibrary{calc}

\newtcolorbox{mybox}{ enhanced, left=0pt, right=0pt, top=8pt, bottom=8pt, colback=red!5, colframe=red, width=\textwidth, enlarge left by=0mm, boxsep=5pt, fontupper=\itshape\small, arc=4pt, outer arc=4pt, leftupper=1.5cm, overlay={ \node[anchor=west] at ([xshift=10pt] $ (frame.north west)!0.5!(frame.south west) $ ) {\includegraphics[width=1cm,height=1cm]{example-image-a}};} } \begin{document} \begin{mybox} Add some text here in the center \end{mybox}

\end{document}

js bibra
  • 21,280