5

I'm trying to produce a graph in Tikz using the Simple style but the vertices won't get smaller than 6pt or so and I'd like them to be much smaller. The code looks like this and if you try it out, the vertices don't actually shrink to 2pt.

\begin{tikzpicture}
\GraphInit[vstyle=Simple]
\SetGraphUnit{1.5}
\tikzset{VertexStyle/.style = {shape = circle,fill = black,minimum size = 2pt}}
\Vertex{D}
\NOEA(D){A}
\SOEA(A){B}
\SOEA(D){C}
         % \Edges{A,B,C,D,A}
\Edges(A,B,C,D,A)
\end{tikzpicture}

Any ideas?

3
  • 2
    Try to also set the inner sep to a lower value, e.g. zero. Jun 21, 2011 at 16:54
  • Worked out great, thanks! What is this parameter doing exactly, I'm not sure: is it to control the minimal size of the inside of nodes? Jun 21, 2011 at 17:22
  • It's not exactly with tikz but with tkz-graph. Yes it's based on TikZ but the syntax is different but you can mix the tkz code with TikZ code. I'm not sure that everybody understand the question. Jun 21, 2011 at 17:45

2 Answers 2

5

You also need to set the inner sep value to 0pt. This parameter sets the inner separation between the node content (empty box in your case) and the official node border. The minimal size, however, controls the minimal height and width of the node content (only).

1
  • That "node content (only)" is misleading as it could refer to "only the text" (as in the previous sentence) or "whatever is inside the node boundary". The minimum size controls the minimum size including the inner sep but excluding the outer sep. Try \node[draw,inner sep=1cm,minimum size=3cm] (a) {}; \draw (a.north west) -- +(3,-3);. Jun 21, 2011 at 18:33
3

Yes is it to control the minimal size of the inside of nodes by default I keep inner sep =2pt. You make a mistake with Edgesnow with the ctan version you need to use parenthesis (A,B,C,D). There is a macro to draw directly a square if you want.

\documentclass{scrartcl}

\usepackage{tkz-graph}

\begin{document}
    \begin{tikzpicture}
    \GraphInit[vstyle=Simple]
    \SetGraphUnit{1.5}
    \tikzset{VertexStyle/.style = {shape = circle,fill = black,minimum size = 2pt,inner sep=0pt}}
    \Vertex{D}
    \NOEA(D){A}
    \SOEA(A){B}
    \SOEA(D){C}
 \Edges(A,B,C,D,A)
    \end{tikzpicture} 
\end{document}  

enter image description here

to get a square : i use a circle because the nodes are on a circle :)

\begin{tikzpicture} 
\SetGraphUnit{2} 
\Vertices{circle}{A,B,C,D}
\end{tikzpicture}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .