1

i want put text over image in textblock.

Last post: vspace, hspace don't work in textblock

My minimal coding:

\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}

enter image description here enter image description here

3

1 Answer 1

1

With help of the \tikz: enclose image in node and then relative to node add nodes with letters X, Y, Z or whatever.

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .