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'm just starting to use Latex and I was wondering if it's possible to produce a graphic like the following.

Relations

It seems like I would have to start with something like a table and then somehow add in the arrows. Any pointers to produce something like this would appreciated.

share|improve this question
    

2 Answers 2

up vote 6 down vote accepted

One possibility using TikZ; you place some nodes and then draw the arrows:

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

\begin{document}

\begin{tikzpicture}[
mydot/.style={
  circle,
  fill,
  inner sep=2pt
},
>=latex,
shorten >= 3pt,
shorten <= 3pt
]
\node[mydot,label={left:1}] (a1) {}; 
\node[mydot,below=of a1,label={left:2}] (a2) {}; 
\node[mydot,below=of a2,label={left:3}] (a3) {}; 
\node[mydot,below=of a3,label={left:4}] (a4) {}; 

\node[mydot,right=2cm of a1,label={right:1}] (b1) {}; 
\node[mydot,below=of b1,label={right:2}] (b2) {}; 
\node[mydot,below=of b2,label={right:3}] (b3) {}; 
\node[mydot,below=of b3,label={right:4}] (b4) {}; 

\path[->] (a1) edge (b1)
  edge (b2)
  edge (b3)
  edge (b4);
\path[->] (a2) edge (b3)
  edge (b4);
\path[->] (a3) edge (b1)
  edge (b3);
\path[->] (a4) edge (b2) 
  edge (b4);
\end{tikzpicture}

\end{document}

enter image description here

A more "traditional" approach using the picture environment:

\documentclass{article}

\begin{document}

\setlength{\unitlength}{.5in}
\begin{picture}(0,0)(3,4)
\linethickness{1pt}

\multiput(0,0)(0,1){4}{$\bullet$}
\multiput(2,0)(0,1){4}{$\bullet$}

\put(-0.2,0){4}
\put(-0.2,1){3}
\put(-0.2,2){2}
\put(-0.2,3){1}

\put(2.2,0){4}
\put(2.2,1){3}
\put(2.2,2){2}
\put(2.2,3){1}

\put(0.2,0.1){\vector(2,1){1.8}}
\put(0.2,0.1){\vector(1,1){1.8}}
\put(0.2,0.1){\vector(1,0){1.8}}
\put(0.2,1.1){\vector(1,0){1.8}}
\put(0.2,2.1){\vector(2,1){1.8}}
\put(0.2,2.1){\vector(1,0){1.8}}
\put(0.2,2.1){\vector(1,-1){1.8}}
\put(0.2,3){\vector(1,-1){1.8}}
\put(0.2,3.1){\vector(1,0){1.8}}
\end{picture}

\end{document}

enter image description here

share|improve this answer
    
That's exactly what I need. Thanks! Another quick question though, what does this part >=latex, shorten >= 3pt, shorten <= 3pt do? –  user3254763 Feb 4 at 3:57
    
@user3254763 those options shorten the start (shorten <= 3pt) and end (shorten >= 3pt) of the arrows so they don't touch the filled circles. –  Gonzalo Medina Feb 4 at 4:10

With PSTricks just for fun as usual.

\documentclass[preview,border=12pt]{standalone}
\usepackage{pst-node,multido}
\begin{document}
\nointerlineskip
\begin{psmatrix}[rowsep=1,colsep=2,mnode=dot]
[name=l1]   & [name=r1]\\
[name=l2]   & [name=r2]\\
[name=l3]   & [name=r3]\\
[name=l4]   & [name=r4]
\end{psmatrix}
\multido{\i=1+1}{4}{\uput[180](l\i){\i}\uput[0](r\i){\i}}
\psset{nodesep=3pt,arrows=->}
\ncline{l1}{r1}
\ncline{l1}{r2}
\ncline{l2}{r4}
% just add your own connecting lines here
\end{document}

enter image description here

share|improve this answer

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.