答案1
\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}
答案2
tcolorbox
栅格中嵌套环境的一种方法。
tcolorbox
通过更多的设置和时间,它应该可以在专门的环境和特殊的风格中使用。
raster multicolumn
在我看来,一个很好的特点就是这种方法。
请注意,这个盒子不再易碎!
\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}
答案3
使用纯 TeX 宏集的解决方案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}