Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Comments on How can I reuse a set of nodes in Tikz?

Post

How can I reuse a set of nodes in Tikz?

+1
−0

I have a graph in TikZ which I would like to use multiple times, with variations. As a simple example, say I have the following set of nodes

\begin{tikzpicture}
  \node (a) at (0, 0) [circle,draw] {a};
  \node (b) at (1, 0) [circle,draw] {b};
  \node (c) at (1, 1) [circle,draw] {c};
\end{tikzpicture}

In the first graph, I'd like to simply draw edges from a to b, b to c, and c to a. In the second graph, I'd like to do the same thing, but with some bold edges, and maybe an additional node. And so on.

Instead of copying this multiple times, is there an easy way to reuse a set of nodes in each graph?

In addition, it would be good if it worked with the graph drawing algorithms, since simply copy-pastes results in slightly different computed positions even with the same random seed, so I'd like to generate the node positions once and reuse them.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

In case you don't get an answer here, please note that there are Q&A sites specially for latex and fr... (1 comment)
In case you don't get an answer here, please note that there are Q&A sites specially for latex and fr...
samcarter‭ wrote 4 months ago · edited 4 months ago

In case you don't get an answer here: please note that there are Q&A sites specifically for latex and friends, e.g. https://topanswers.xyz/tex (if you decide to re-ask there, please include a small, but compilable test document, so that people can see which class you use. If it happens to be beamer, this would be a piece of cake with the overlay-beamer-styles library, see e.g. https://topanswers.xyz/tex?q=1798#a2030)