I have this code:


\usetikzlibrary{arrows, automata}
\def\storedata#1#2{\tmpnum=0 \edef\tmp{\string#1}\storedataA#2\end}
\def\storedataA#1{\advance\tmpnum by1
      \expandafter\def\csname data:\tmp:\the\tmpnum\endcsname{#1}%
\def\getdata[#1]#2{\csname data:\string#2:#1\endcsname}

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1cm,
  \tikzstyle{every state}=[draw=none,text=black]

  \def \n {4}
  \def \radius {1.3cm}
  \def \margin {5} % margin in angles, depends on the radius

  \foreach \s in {1,...,\n}
    \node[state] (\getdata[\s]\moredata) at ({360/\n * (\s - 1)+45}:\radius) {$\getdata[\s]\moredata$};

  \path (A) edge              node {} (B);
  \path (B) edge              node {} (A);
  \path (A) edge              node {} (C);
  \path (D) edge              node {} (B);
  \path (D) edge              node {} (C);
  \path (C) edge              node {} (A);
  \path (C) edge              node {} (B);
  \path (C) edge              node {} (D);
  \path (C) edge[loop right]  node {} (C);

I have several questions:

  1. What does shorten >= 1 pt do?
  2. What does node distance do?
  3. What does margin do?
  4. What does stealth do?
  5. When I compile the document, there seems to be a lot of space between the tip of the arrow and the letter. How do I change that?
  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jul 10 '17 at 17:13
  • For Questions 1-4 you can look into the pgf manual. For example you can find shorten on page 162. If you want an answer for question 5 you should add a minimal working example (MWE). – dexteritas Jul 10 '17 at 17:18
  • 2
    Usually you should ask each in a separate TeX.SX "question". – dexteritas Jul 10 '17 at 17:21
  • 2
    If you're unsure what a particular option does, you can comment it with a %, or change the length that comes with it. Then, see what changed on the drawing. If nothing has changed, it probably means you don't need that option. – marsupilam Jul 10 '17 at 17:32
  • 2
    (i) your MWE doesn't work (ii) shorten >= 1 make line shorter on destination side for 1pt (iii) node distance determine distance between nodes in image (if you not override it) (iv) margin as option of geometry package determine text margins on page, in your code is defined for unknown purposes (see (i)), (v) stealth is one of among predetermined arrow heads. – Zarko Jul 10 '17 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.