我想将文本放在文本块中的图像上。
我的最低限度的编码:
\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[poster]{tcolorbox}
\usepackage[absolute]{textpos}
\pagestyle{empty}
\begin{document}
\begin{textblock*}{10cm}(3.0cm,3.5cm)
\begin{center}
\small X \vspace*{0.5cm}
\Huge Y \vspace*{0.2cm}
\small Z
\includegraphics[width=8cm]{example-image-a}
\end{center}
\end{textblock*}
\end{document}
答案1
借助\tikz
:将图像括在节点中,然后相对于节点添加带有字母 X、Y、Z 或其他字母的节点。
\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[poster]{tcolorbox}
\usepackage[absolute]{textpos}
\pagestyle{empty}
\usepackage{tikz} % new
\usetikzlibrary{positioning} % new
\begin{document}
\begin{textblock*}{10cm}(3.0cm,3.5cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (image) [inner sep=0pt] {\includegraphics[width=8cm]{example-image-duck}};
\node[below=5mm of image.north, font=\small, text=red] {X};
\node[font=\huge, text=red] {Y};
\node[above=5mm of image.south, font=\small, text=red] {Z};
}
\end{center}
\end{textblock*}
\end{document}