TransWikia.com

Place text over image in textpos

TeX - LaTeX Asked by latexforti on February 2, 2021

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

One Answer

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

Answered by Zarko on February 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP