TransWikia.com

Why does my tikz text appear behind my image?

TeX - LaTeX Asked on August 1, 2021

How can i bring my text to the front of my image ? The code below puts it behind the image. I tell tikz node front but its still behind ?

begin{figure}
centering
begin{tikzpicture}
    node[draw,front] at (0,0) {some text};
    node[anchor=south west,inner sep=0] (image) at (0,0) {includegraphics[width=0.8columnwidth,trim={0 3cm 0 0},clip]{figures/intro/intro1.png}};
    begin{scope}[x={(image.south east)},y={(image.north west)}]
        draw[fill=white, ultra thick, rounded corners] (0.5,0.2) rectangle (0.9,0.05);
    end{scope}
end{tikzpicture} 
end{figure}

enter image description here

One Answer

Switch the order of the statements so the text is set last; items are drawn sequentially within the code:

enter image description here

documentclass{article}

usepackage{graphicx,tikz}

begin{document}

begin{figure}
  centering
  begin{tikzpicture}
    node[anchor=south west,inner sep=0] (image) at (0,0) {includegraphics[width=0.8columnwidth,trim={0 3cm 0 0},clip]{example-image}};
    begin{scope}[x={(image.south east)},y={(image.north west)}]
      draw[fill=white, ultra thick, rounded corners] (0.5,0.2) rectangle (0.9,0.05);
    end{scope}
    node[draw] at (0,0) {some text};
  end{tikzpicture} 
end{figure}

end{document}

Correct answer by Werner on August 1, 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