Graphics, Figures & TablesCan I draw a path by its path name?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

Can I draw a path by its path name?

Post by topsquark »

Say I have the following simple code:
\coordinate (A) at (0,0); \coordinate (B) at (1,1);
\path[name path=AB] (A) -- (B);

Can I draw this path later on by invoking its path name, AB? Like \draw AB, or something? (Yeah, that doesn't work!) I'm doing some work where I've got a number of paths defined and it would be nice, not necessary, to be able to define them, then draw them later on in the code.

Thanks!

-Dan

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

Can I draw a path by its path name?

Post by topsquark »

Okay, I answered my own question:
\path[save path=\AB] (A) -- (B);
\draw[use path=\AB];

Thanks!

-Dan
Post Reply