Box around text, image in corner of said box. How do I do it?
This is quite easy with tcolorbox
and its overlay
feature, placing a node at frame.south east
, the node content is an \includegraphics
command here.
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}
\begin{document}
\begin{tcolorbox}[enhanced,sharp corners,
width={10cm},
colback=white,
overlay={\node at (frame.south east) {\includegraphics[scale=0.1]{ente}};} ]
Sample text here.
\end{tcolorbox}
\end{document}
With a 'blob'
\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcolorbox}[enhanced,sharp corners,
width={10cm},
colback=white,
overlay={\node[circle,fill,red] at (frame.south east) { A };} ]
Sample text here.
\end{tcolorbox}
\end{document}
With blue frame
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}
\begin{document}
\begin{tcolorbox}[enhanced,sharp corners,
width={10cm},
colback=white,
overlay={\node[rectangle,draw,blue,line width=10pt] at (frame.south east) {\includegraphics[scale=0.1]{ente}};} ]
Sample text here.
\end{tcolorbox}
\end{document}
In ConTeXt, it is possible to achieve this effect by using Layers and Overlays. In the example below, I define a new frame called cowframe
which places a cow at the bottom right corner of the frame.
\setupexternalfigures[location={local,default}]
\definelayer[cowframe][width=\overlaywidth, height=\overlayheight]
\startsetups cowframe
\setlayer[cowframe]
[corner={right,bottom}, location={middle,middle}]
{\externalfigure[cow][height=3\lineheight]}
\stopsetups
\defineoverlay[cowframe][{\directsetup{cowframe}\tightlayer[cowframe]}]
\defineframed
[cowframe]
[
frame=on,
background=cowframe,
align={normal,hyphenated},
width=8cm,
offset=0.5em,
]
\starttext
\cowframe{\input ward\endgraf}
\stoptext
which gives