Understanding styles
We already customized nodes and edges using several key=value
options within square brackets. Examples of keys are color
, shape
, width
, and font
.
We can define our own key=value
sets. In TikZ, we commonly call such a set a style; and we give it a name. The name itself is also called a key in TikZ. The benefit for us is that such styles can contain a lot of various key=value
settings and even code snippets.
Using styles is like working with macros in LaTeX. We can compare styles and macros in this way:
- If we have code that we use several times, we create a macro in LaTeX. If we have graphical properties values that we use several times, we create a named style in TikZ.
- Macros in LaTeX separate formatting from the content. Styles in TikZ separate graphical properties from the content of a drawing.
- Macros and styles save us from repeating code and help structure our documents and drawings.
Named keys have properties, such as a style, and...