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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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