Graphics, Figures & Tables ⇒ TikZ determine coordinate of a node
TikZ determine coordinate of a node
I have the following problem:
I have a series of nodes within a foreach statement. They are being drawn on a vertical line, but all have different widths.
How do I determine the node that reaches the furthest out to the left?
I know that there is the "let" path operation, with which I can get the x-coordinate of every node but I can only draw stuff and not memorize the x-coordinates to compare them after the foreach to find the lowest x.
Is there any other way to determine the x-coordinate of a node?
Thx for any hint, suggestion etc!
cherio Woltan
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
TikZ determine coordinate of a node
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}
\node (polarizer) at (0,1) [draw,rectangle,minimum width=1cm]{};
\node (quarter wave) at (0,2) [draw,rectangle,minimum width=3cm]{};
\node (box) [draw,rectangle,dotted, inner sep=2mm,fit = (polarizer) (quarter wave)]{};
\end{tikzpicture}
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: TikZ determine coordinate of a node
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10