I'm trying to create a tikz picture where I have an image with some text to the right of it. Between the image and the text I want to draw a vertical line that is the same distance away from the edge of the image as from the edge of the text. See the included picture.
Currently I have the following code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt] (image) at (0,0)
{\includegraphics[width=.25\textwidth]{example-image-a}};
\node[anchor = west ,xshift=0cm, yshift=0, text width = 0.5\textwidth, right = of image]{\Huge Text};
\draw[line width=1mm](2.25,-1) -- +(0,2);
\end{tikzpicture}
\end{document}
Important to note is that I would prefer an exact solution, not an estimation like I did by having the line at x=2.25 within the tikz picture (which 'looks' right). I would like a solution that dynamically changes location when the images is moved (the text already moves dynamically with the picture using right=of image
).