Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to make all the nodes the same size. But the problem is that some of them have more text in them so they automatically get bigger. Any help would be nice thanks.

Code

\begin{tikzpicture}
  [scale=.5,auto=left,every node/.style={circle,inner sep=0pt, fill=blue!20}]  
  \node (n1) at (-5,1) {$v_{1}$}; 
  \node (n2) at (-5,6) {$v_{i}$};
  \node (n3) at (-5,11) {$v_{n}$};
  \node (n4) at (1,-5) {$u_{1}$}; 
  \node (n5) at (6,-5) {$u_{j}$};
  \node (n6) at (11,-5) {$u_{n}$};
  \node (n7) at (1,1) {$(u_{1},v_{1})$}; 
  \node (n8) at (1,6) {$(u_{1},v_{i})$};
  \node (n9) at (1,11) {$(u_{1},v_{n})$};

  \node (n10) at (6,1) {$(u_{j},v_{1})$}; 
  \node (n11) at (6,6) {$(u_{j},v_{i})$};
  \node (n12) at (6,11) {$(u_{j},v_{n})$};

  \node (n13) at (11,1) {$(u_{m},v_{1})$}; 
  \node (n14) at (11,6) {$(u_{m},v_{i})$};
  \node (n15) at (11,11) {$(u_{m},v_{n})$};

\foreach \from/\to in {n2/n3,n1/n2,n4/n5,n5/n6,n7/n8,n8/n9,n10/n11,n11/n12,n13/n14,n14/n15,n9/n12,n12/n15,n8/n11,n11/n14,n7/n10,n10/n13}
\draw[loosely dotted] (\from) -- (\to);
   \path [every node/.style={font=\scriptsize, inner sep=+.1667em}] 
        (n1) edge [bend left]  node[swap] {} (n3)
        (n4) edge [bend right]  node[swap] {} (n6)
        (n9) edge [bend right]  node[swap] {$a$} (n7)
        (n7) edge [bend right]  node[swap] {$b$} (n13)              (n13) edge [bend right]  node[swap] {$c$} (n15)
        (n15) edge [bend right]  node[swap] {$d$} (n9);
\end{tikzpicture}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You can set a minimum size value:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  [scale=.5,auto=left,every node/.style={circle,inner sep=0pt, fill=blue!20,minimum size=39pt}]  
  \node (n1) at (-5,1) {$v_{1}$}; 
  \node (n2) at (-5,6) {$v_{i}$};
  \node (n3) at (-5,11) {$v_{n}$};
  \node (n4) at (1,-5) {$u_{1}$}; 
  \node (n5) at (6,-5) {$u_{j}$};
  \node (n6) at (11,-5) {$u_{n}$};
  \node (n7) at (1,1) {$(u_{1},v_{1})$}; 
  \node (n8) at (1,6) {$(u_{1},v_{i})$};
  \node (n9) at (1,11) {$(u_{1},v_{n})$};

  \node (n10) at (6,1) {$(u_{j},v_{1})$}; 
  \node (n11) at (6,6) {$(u_{j},v_{i})$};
  \node (n12) at (6,11) {$(u_{j},v_{n})$};

  \node (n13) at (11,1) {$(u_{m},v_{1})$}; 
  \node (n14) at (11,6) {$(u_{m},v_{i})$};
  \node (n15) at (11,11) {$(u_{m},v_{n})$};

\foreach \from/\to in {n2/n3,n1/n2,n4/n5,n5/n6,n7/n8,n8/n9,n10/n11,n11/n12,n13/n14,n14/n15,n9/n12,n12/n15,n8/n11,n11/n14,n7/n10,n10/n13}
\draw[loosely dotted] (\from) -- (\to);
   \path [every node/.style={font=\scriptsize, inner sep=+.1667em}] 
        (n1) edge [bend left]  node[swap] {} (n3)
        (n4) edge [bend right]  node[swap] {} (n6)
        (n9) edge [bend right]  node[swap] {$a$} (n7)
        (n7) edge [bend right]  node[swap] {$b$} (n13)              (n13) edge [bend right]  node[swap] {$c$} (n15)
        (n15) edge [bend right]  node[swap] {$d$} (n9);
\end{tikzpicture}

\end{document}

enter image description here

Perhaps you could be interested in the positioning library to help you place your nodes without explicit coordinates.

The code with the positioning library:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
  [scale=.5,auto=left,every node/.style={circle,inner sep=0pt, fill=blue!20,minimum size=38pt},node distance=1.35cm and 1.35cm]  

  \node (n7) at (1,1) {$(u_{1},v_{1})$}; 
  \node[above=of n7] (n8) {$(u_{1},v_{i})$};
  \node[above=of n8] (n9) {$(u_{1},v_{n})$};

  \node[right=of n7] (n10) {$(u_{j},v_{1})$}; 
  \node[above=of n10] (n11) {$(u_{j},v_{i})$};
  \node[above=of n11] (n12) {$(u_{j},v_{n})$};

  \node[right=of n10] (n13) {$(u_{m},v_{1})$}; 
  \node[above=of n13] (n14) {$(u_{m},v_{i})$};
  \node[above=of n14] (n15) {$(u_{m},v_{n})$};

  \node[left=of n7] (n1) {$v_{1}$}; 
  \node[above=of n1] (n2)  {$v_{i}$};
  \node[above=of n2] (n3) {$v_{n}$};

  \node[below=of n7] (n4) {$u_{1}$}; 
  \node[right=of n4] (n5)  {$u_{j}$};
  \node[right=of n5] (n6) {$u_{n}$};

\foreach \from/\to in {n2/n3,n1/n2,n4/n5,n5/n6,n7/n8,n8/n9,n10/n11,n11/n12,n13/n14,n14/n15,n9/n12,n12/n15,n8/n11,n11/n14,n7/n10,n10/n13}
\draw[loosely dotted] (\from) -- (\to);
   \path [every node/.style={font=\scriptsize, inner sep=+.1667em}] 
        (n1) edge [bend left]  node[swap] {} (n3)
        (n4) edge [bend right]  node[swap] {} (n6)
        (n9) edge [bend right]  node[swap] {$a$} (n7)
        (n7) edge [bend right]  node[swap] {$b$} (n13)              (n13) edge [bend right]  node[swap] {$c$} (n15)
        (n15) edge [bend right]  node[swap] {$d$} (n9);
\end{tikzpicture}

\end{document}
share|improve this answer
    
Thanks a lot. I'll look into positioning. –  user90401 Sep 17 '13 at 4:01
    
@user90401 You're welcome. I updated my answer with an example using positioning. –  Gonzalo Medina Sep 17 '13 at 4:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.