11

I have a question on how to "style" the self loops in my diagram.

Here is my preamble:

\documentclass[letterpaper]{tufte-handout}

% Additional LaTeX Packages

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

% LaTeX TikZ Graphics Package

\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{
    >=stealth,
    auto,
    node distance=3.5cm,
    font=\scriptsize,
    possible world/.style={circle,draw,thick,align=center},
    real world/.style={double,circle,draw,thick,align=center},
    minimum size=40pt
}

and here is my current attempt at a diagram:

\begin{figure}
\centering
\begin{tikzpicture}
\node[real world] (1) {$\World_{1}$ \\ $H,L$};
\node[possible world] (2) [right of=1] {$\World_{2}$ \\ $\neg{H},L$};
\node[possible world] (3) [below of=1] {$\World_{3}$ \\ $\neg{H},L$};
\node[possible world] (4) [right of=3] {$\World_{4}$ \\ $\neg{H},L$};
\path[]
    (1) edge [loop above,thick] node {$A,B,C$} (1)
    (2) edge [loop above,thick] node {$A,B,C$} (2)
    (3) edge [loop below,thick] node {$A,B,C$} (3)
    (4) edge [loop below,thick] node {$A,B,C$} (4)
    (1) [<->,thick] edge node[above] {$B$} (2)
    (3) [<->,thick] edge node[below] {$A,B,C$} (4)
    (1) [->,thick] edge node[left] {$C$} (3)
    (1) [->,thick] edge node[right] {$C$} (4)
    (2) [->,thick] edge node[left] {$C$} (3)
    (2) [->,thick] edge node[right] {$C$} (4);
\end{tikzpicture}
\caption{Successor state, $\State_{2}$, obtained after $A$ peeks into the strongbox and learns that the coin is facing heads up without the knowledge of his fellow agents.}
\label{fig:multi-modal-strongbox:peek-2-successor}
\end{figure}

The picture that I am getting looks like this:

enter image description here

But I really want the arcs to look like the ones in this example:

enter image description here

I don't mind having the labels be above or below the arc and not in the middle, but the overall shape of the self loops is what I'm interested in replicating.

Also, as a side note - I've been unable to find a way to increase the horizontal separation between the nodes. Any suggestions would be appreciated.

12

You can use positioning library to adjust the horizontal distance between nodes. Also note that right of =... is replaced with right = <dimen>cm of ... here as the former is deprecated. You can put four extra nodes for A, B, C and adjust the edge with in=...,out=... parameters. As I don't know what \World etc are, I have replaced them with World etc. Further, I have adjusted minimum size at few places as you have globally defined it (which I wouldn't do generally).

Full code:

\documentclass[letterpaper]{tufte-handout}

% Additional LaTeX Packages

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

% LaTeX TikZ Graphics Package

\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\tikzset{
    >=stealth,
    %auto,
    %node distance=3.5cm,
    font=\scriptsize,
    possible world/.style={circle,draw,thick,align=center},
    real world/.style={double,circle,draw,thick,align=center},
    minimum size=40pt
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node[real world] (1) {$World_{1}$ \\ $H,L$};
\node[above = .1ex of 1,inner sep = 0pt,outer sep=0pt,minimum size=25pt] (1a) {$A,B,C$};
\node[possible world] (2) [right = 5cm of 1] {$World_{2}$ \\ $\neg{H},L$};
\node[above = .1ex of 2,inner sep = 0pt,outer sep=0pt,minimum size=25pt] (2a) {$A,B,C$};
\node[possible world] (3) [below = 2cm of 1] {$World_{3}$ \\ $\neg{H},L$};
\node[below = .1ex of 3,inner sep = 0pt,outer sep=0pt,minimum size=25pt] (3a) {$A,B,C$};
\node[possible world] (4) [right = 5cm of 3] {$World_{4}$ \\ $\neg{H},L$};
\node[below = .1ex of 4,inner sep = 0pt,outer sep=0pt,minimum size=25pt] (4a) {$A,B,C$};
\path[]
    (1) edge [in=180, out=130,thick] (1a)
    (1a) edge [->,in=50, out=0,thick] (1) 
    (2) edge [in=180, out=130,thick] (2a)
    (2a) edge [->,in=50, out=0,thick]  (2)
    (3) edge [in=180, out=230,thick] (3a)
    (3a) edge [->,in=310, out=0,thick]  (3)
    (4) edge [in=180, out=230,thick] (4a)
    (4a) edge [->,in=310, out=0,thick]  (4)
    (1) [<->,thick] edge node[above,minimum size=0pt] {$B$} (2)
    (3) [<->,thick] edge node[below,minimum size=0pt] {$A,B,C$} (4)
    (1) [->,thick] edge node[left,minimum size=0pt] {$C$} (3)
    (1) [->,thick] edge node[right] {$C$} (4)
    (2) [->,thick] edge node[left] {$C$} (3)
    (2) [->,thick] edge node[right,minimum size=0pt] {$C$} (4);
\end{tikzpicture}
\caption{Successor state, $State_{2}$, obtained after $A$ peeks into the strongbox and learns that the coin is facing heads up without the knowledge of his fellow agents.}
\label{fig:multi-modal-strongbox:peek-2-successor}
\end{figure}
\end{document}

enter image description here

  • What does that formula S x t x a x t x e do? :P – percusse Nov 2 '13 at 7:56
  • Then why leaving it in? It's a typo-crime you know :) – percusse Nov 2 '13 at 8:05

Your Answer

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

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