# How can I put the image at right corner of tcolorbox and keep writting below it?

I'm trying to put one image at right corner of tcolorbox but, the \tcblower option wastes a lot of space, I want write around the image, but I cant find a real answer.

## 3 Answers

\documentclass[]{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{wrapfig}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcolorbox}[colback=white!60!yellow,colframe=red]

\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.4\textwidth]{example-image}
\end{center}
\caption{image}
\end{wrapfigure}

\lipsum[1]

\end{tcolorbox}
\end{document}

• Where is the tcolorbox? – Rmano Jun 14 '16 at 20:07
• @Rmano I just edited my proposed solution...added the tcolor box – user95439 Jun 14 '16 at 20:12
• I think the solution using the wrapfig package is the best! check out this link for more usage of this package. sharelatex.com/learn/Wrapping_text_around_figures – user95439 Jun 14 '16 at 20:23
• @KKK: Saying that a solution is 'the best' is very opinion based ;-) – user31729 Jun 15 '16 at 8:04

A way with nested tcolorbox environments in a raster.

With more setup and time this should be used with specialized tcolorbox environments and special styles.

A nice feature is the raster multicolumn approach, in my point of view.

Please note, that this box is not breakable any longer!

\documentclass{article}

\usepackage[most]{tcolorbox}

\usepackage{blindtext}
\begin{document}
\tcbset{innerboxstyle/.style={left=0pt,right=0pt,top=0pt,bottom=0pt,sharp corners,colback=white!60!yellow,enhanced jigsaw,boxrule=0pt,leftright skip=0pt,boxsep=0pt}}

\begin{tcolorbox}[colback=white!60!yellow,colframe=red,left=2pt,right=2pt,top=2pt]
\begin{tcbraster}[raster columns=3,raster valign=top,sharp corners,colback=white!60!yellow, raster left skip=0pt,right skip=0pt]
\begin{tcolorbox}[innerboxstyle,raster multicolumn=2]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis
facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent
imperdiet mi nec ante. Donec ullamcorper, felis non sodales commodo,
lectus velit ultrices augue, a dignissim nibh lectus placerat pede. Viva-
mus nunc nunc, molestie ut, ultricies vel, semper in, velit.
\end{tcolorbox}
\begin{tcolorbox}[halign=center,innerboxstyle]
\includegraphics[scale=0.2]{ente.jpg}
\end{tcolorbox}
\end{tcbraster}
\blindtext
\end{tcolorbox}

\end{document}


• Thanks but I got this error Package pgfkeys Error: I do not know the key '/tcb/raster multicolumn', to which you passed '2', and I am going to ignore it. Perhaps you misspelled it. ...orbox}[innerboxstyle,raster multicolumn=2] thanks again – alejandro muñoz Jun 14 '16 at 20:27
• @alejandromuñoz: You have to update tcolorbox then! – user31729 Jun 14 '16 at 20:33

A solution with the plain TeX set of macros insbox:

\documentclass[11pt, x11names]{article}

\usepackage[utf8]{inputenc} %
\usepackage[T1]{fontenc}
\usepackage{cabin} \usepackage{geometry}
\usepackage{tcolorbox} %
\input{insbox}

\begin{document}

\begin{tcolorbox}[width=\linewidth, fonttitle =\sffamily\bfseries\Large, title=Bright Star, colback=MistyRose1!40, colframe=IndianRed3, fontupper=\sffamily, ]%
\leavevmode
{\InsertBoxR{0}{\includegraphics[scale=0.75]{sunstar}}[1]
The Sun is the star at the center of the Solar System and is by far the most important source of energy for life on Earth. It is a nearly perfect sphere of hot plasma \textsuperscript{[13][14]} with internal convective motion that generates a magnetic field via a dynamo process.\textsuperscript{[15] } Its diameter is about 109 times that of Earth, and its mass is about 330,000 times that of Earth, accounting for about 99.86\,\% of the total mass of the Solar System.\textsuperscript{[16]} About three quarters of the Sun's mass consists of hydrogen; the rest is mostly helium, with much smaller quantities of heavier elements, including oxygen, carbon, neon, and iron.\textsuperscript{[17]}
}

The Sun is a G-type main-sequence star (G2V) based on spectral class and it is informally referred to as a yellow dwarf. It formed approximately 4.6 billion\textsuperscript{[a][9][18]} years ago from the gravitational collapse of matter within a region of a large molecular cloud. Most of this matter gathered in the center, whereas the rest flattened into an orbiting disk that became the Solar System. The central mass became increasingly hot and dense, eventually initiating nuclear fusion in its core. It is thought that almost all stars form by this process.
\end{tcolorbox}

\end{document}