Using styles globally and locally
Using the \tikzset
command, you can define styles globally for your whole document. This is especially useful when you have several similar drawings in your document. For example, in a book about graph theory, you` probably want to have the same styles for vertices, edges, and labels in all drawings throughout the book, so it’s good to use \tikzset
in the preamble.
In older documents, you will see the \tikzstyle
command with the following form:
\tikzstyle{my style} = [options]
That command is deprecated and should not be used anymore, according to the TikZ creator, so bear this in mind when you see it in older code on the internet.
In situations where styles between drawings are different, it can be preferable to define styles locally, so they are only valid in a single picture. That can be done by setting the styles as options in the tikzpicture
environment. For example, if you have a drawing where you want to have a particular...