Graphics, Figures & TablesDrawing partitions

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
notnek
Posts: 11
Joined: Mon Dec 07, 2009 5:09 pm

Drawing partitions

Post by notnek »

I'm a LaTeX beginner and I'm trying to represent non-crossing pair partitions. An example of the kind of thing I want is in the attached jpg.

This is only an example so I would like to be able to draw anything that looks like it with different values and partitions.

I have installed the pgf package but I don't want to go through the whole manual so I can do this one thing. Can someone guide me through how to do it or give an example of some code for e.g. 3 partitions?

Thanks in advance.
Attachments
partitions.jpg
partitions.jpg (5.14 KiB) Viewed 3332 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Drawing partitions

Post by localghost »

notnek wrote:[…] I have installed the pgf package but I don't want to go through the whole manual so I can do this one thing. […]
Sooner or later you will have study the manual. Some code off the top of my head.

Code: Select all

\documentclass{minimal}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}[thick,font=\small]
    \path (0,0) node[circle,draw] (a) {1}
          (1,0) node[circle,draw] (b) {2}
          (2,0) node[circle,draw] (c) {3}
          (3,0) node[circle,draw] (d) {4}
          (4,0) node[circle,draw] (e) {5}
          (5,0) node[circle,draw] (f) {6};
    \draw (a) -- +(0,0.75) -| (d);
    \draw (b) -- +(0,0.5) -| (c);
    \draw (e) -- +(0,0.75) -| (f);
  \end{tikzpicture}
\end{document}

Best regards and welcome to the board
Thorsten
Post Reply