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

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

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