8

I am trying to create the following picture with tikz enter image description here

I have found this block of code, which outputs a similar result of what I want to get:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows ,calc}

\tikzset{
    modal/.style={>=stealth’,shorten >=1pt,shorten <=1pt,auto,node distance=1.5cm,
        semithick},
    world/.style={circle,draw,minimum size=0.5cm,fill=gray!15},
    point/.style={circle,draw,inner sep=0.5mm,fill=black},
    reflexive above/.style={->,loop,looseness=7,in=120,out=60},
    reflexive below/.style={->,loop,looseness=7,in=240,out=300},
    reflexive left/.style={->,loop,looseness=7,in=150,out=210},
    reflexive right/.style={->,loop,looseness=7,in=30,out=330}
}
\begin{document}


\begin{tikzpicture}[modal,node distance=4cm]
\node (A) {A};
\node (E) [right=of A] {E};
\node (I) [below=of A] {I};
\node (O) [below=of E] {O};
\coordinate (CENTER) at ($(A)!0.5!(O)$);
\node (contra) at (CENTER) {contradictory};
\path[<->] (A) edge node[above] {contrary} (E);
\path[<->] (I) edge node[below] {subcontrary} (O);
\path[->] (A) edge node[above,rotate=90] {subaltern} (I);
\path[->] (E) edge node[above,rotate=-90] {subaltern} (O);
\path[->] (contra) edge (A);
\path[->] (contra) edge (E);
\path[->] (contra) edge (I);
\path[->] (contra) edge (O);
\end{tikzpicture}

\end{document}

The problem is that I don't know how to add some text near the nodes, without changing the pointing of the arrows.

Furthermore, I get this error: Package pgf Error: Unknown arrow tip kind 'stealth’'.

  • Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. it will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. Your code isen't compilable, so we can't see your result (still now). – Bobyandbob May 27 '17 at 13:28
  • Related to your node problem: Position text next to rectangle in TikZ. So you can use for example \node[label=east:text] (E) [right=of A] {E}; and \node[label=west:text] (I) [below=of A] {I}; – Bobyandbob May 27 '17 at 13:43
  • I have updated the post. But I get some errors when compiling. – Jonathan_Lo May 27 '17 at 14:57
5

Hint to your code: Use >=stealth' instead of >=stealth’ to achive a minimal working example.

You can use:

  • shorten >=0.1cm or shorten <=0.1cm to short the arrow on both ends with a defined length (for example 0.1 here)
  • label=west:your text for labeling (your text) the nodes in different orientation (west, east,...)
  • \node[left=0cm and 0cm of A, node position relative to A
  • some more coordinates like \coordinate (EAST) at ($(E)!0.5!(O)$); or \coordinate (SOUTH) at ($(I)!0.5!(O)$); to place the text near the nodes
  • path color, just \path[blue,->]... enter image description here

MWE:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning,arrows,calc}
\tikzset{
modal/.style={>=stealth',shorten >=1pt,shorten <=1pt,auto,node distance=1.5cm,
semithick},
world/.style={circle,draw,minimum size=0.5cm,fill=gray!15},
point/.style={circle,draw,inner sep=0.5mm,fill=black},
reflexive above/.style={->,loop,looseness=7,in=120,out=60},
reflexive below/.style={->,loop,looseness=7,in=240,out=300},
reflexive left/.style={->,loop,looseness=7,in=150,out=210},
reflexive right/.style={->,loop,looseness=7,in=30,out=330}
}

\begin{document}
\begin{tikzpicture}[modal,node distance=4cm]
\node(A) {A};
\node(E) [right=of A] {E};
\node(I) [below=of A] {I};
\node(O) [below=of E] {O};
\coordinate (CENTER) at ($(A)!0.5!(O)$);
\coordinate (NORTH) at ($(A)!0.5!(E)$);
\coordinate (WEST) at ($(A)!0.5!(I)$);
\coordinate (EAST) at ($(E)!0.5!(O)$);
\coordinate (SOUTH) at ($(I)!0.5!(O)$);
\node (contra) at (CENTER) {text};
\path[blue,->] (A) edge node[left,rotate=0] {} (I);%90
\path[->] (E) edge node[right,rotate=0] {} (O);%-90
\path[shorten <=0.2cm,->] (contra) edge (A);
\path[shorten <=0.2cm,->] (contra) edge (E);
\path[shorten <=0.2cm,->] (contra) edge (I);
\path[shorten <=0.2cm,->] (contra) edge (O);
\path[shorten >=0.5cm,shorten <=0.5cm,->] (contra) edge (EAST);
\path[shorten >=0.5cm,shorten <=0.5cm,->] (contra) edge (WEST);
%
\node (contra) at (NORTH) {text};
\node (pro) at (SOUTH) {text};
%
\path[shorten >=0.3cm,shorten <=0.5cm,->] (contra) edge (E);
\path[shorten >=0.3cm,shorten <=0.5cm,->] (contra) edge (A);
%
\path[->] (pro) edge (I);
\path[->] (pro) edge (O);
%
\node[left=0cm and 0cm of A, label=west:text] {(1)};
\node[left=0cm and 0cm of I, label=west:text] {(1)};
\node[left=0cm and 0cm of WEST, label=west:text] {(0.5)};
\node[right=0cm and 0cm of E, label=east:text] {(1)};
\node[right=0cm and 0cm of O, label=east:text] {(1)};
\node[right=0cm and 0cm of EAST, label=east:text] {(-0.5)};
\end{tikzpicture}
\end{document}

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.