# Two questions about nodes at Tikz

I saw this question How to change the size of nodes? and I wonder:

1. If I want the nodes will be at the same size as automata nodes, what I need to fill at size? (or the scale).
2. If I want make it for all the nodes (I assuming I need to write it at the beginning), what I need to write?

Here is an MWE:

 % Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage{tikz}
\usetikzlibrary{automata}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[state] (1) {$1$};
\end{tikzpicture}
\par\end{center}

\begin{center}
\begin{tikzpicture}
\draw (1,1) node[circle,draw] {$1$};
\end{tikzpicture}
\par\end{center}
\end{document}


Thank you!

• Add a MWE. Nov 19, 2018 at 11:40
• @heblyx, your code contais a lot of non related commands, including font changing. It is not Minimal (MWE). Nov 19, 2018 at 13:09
• @Sigur, I edit my MWE, now it's better? Nov 19, 2018 at 13:29

I interpret the question slightly different than Phelype. If you want all nodes in that picture to have the same size as the state nodes that come with automata, you only need to say every node/.append style={minimum width=2.5em}.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{automata}
\begin{document}
\begin{tikzpicture}
\node[state] (1) {$1$};
\end{tikzpicture}

\begin{tikzpicture}[every node/.append style={minimum width=2.5em}]
\draw (1,1) node[circle,draw] {$1$};
\end{tikzpicture}
\end{document}


• Ooh, much simpler certainly :D Nov 19, 2018 at 13:47
• @PhelypeOleinik I don't know who of us gave the "correct" answer, if any. Let's see. ;-)
– user121799
Nov 19, 2018 at 13:52
• Both of you gave me a great answers! Really - so first of all - Thank you for both! :) The reason I accept your answer @marmot it's because it simpler - but both answers were great and answer my questions! Nov 19, 2018 at 15:42

When you draw a \node [state], you are drawing a \node [circle,draw,minimum size=2.5em,every state].

How to figure this out:

The \usetikzlibrary{<library>} command loads a tikzlibrary<library>.code.tex file. Searching for the tikzlibraryautomata.code.tex file in my TeX distribution I found it at /usr/local/texlive/2018/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/.

I opened the file and searched for state and found at the end of the file:

\tikzstyle{state}=                [state without output]


so state is the same as state without output. Searching for the latter I found:

\tikzstyle{state without output}=  [circle,draw,minimum size=2.5em,every state]


thus, state is the same as circle,draw,minimum size=2.5em,every state, with every state being empty by default:

\tikzstyle{every state}=           []


MWE:

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{automata}
\begin{document}

\begin{center}
\begin{tikzpicture}
\node[state] (1) {$1$};
\end{tikzpicture}
\end{center}

\begin{center}
\begin{tikzpicture}
\draw (1,1) node [circle,draw,minimum size=2.5em,every state] {$1$};
\end{tikzpicture}
\end{center}

\end{document}


Oh, and answering your second question, you can use more or less the same approach as in the package, but change the every node style. To change it globally you can use \tikzset:

\tikzset{
every node/.style = {
circle,draw,minimum size=2.5em,every state
}
}


or, for a single tikzpicture, you can pass this as an option:

\begin{tikzpicture}[
every node/.style = {
circle,draw,minimum size=2.5em,every state
}
]
\draw (1,1) node {$1$};
\end{tikzpicture}


Here is a minimum example to set the size of state to known value.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata}
\begin{document}
\begin{center}
\begin{tikzpicture}[every state/.style={minimum size=2cm},]
\node[state] (1) {$1$};
\end{tikzpicture}

\begin{tikzpicture}
\draw (1,1) node[circle,draw,minimum size=2cm] {$1$};
\end{tikzpicture}
\end{center}
\end{document}