Macaulay2 » Documentation
Packages » Posets :: texPoset
next | previous | forward | backward | up | index | toc

# texPoset -- generates a string containing a TikZ-figure of a poset

- Usage:
    `texPoset P`
    `texPoset(P, SuppressLabels => Boolean)`
    `texPoset(P, Jitter => Boolean)`
    `tex P`
- Inputs:
  - P, an instance of the type Poset,
- Optional inputs:
  - SuppressLabels => a Boolean value, default value true, whether to display or suppress the labels of the poset
  - Jitter => a Boolean value, default value false, whether to randomly jitter the poset vertices
- Outputs:
  - S, a string, a TikZ-figure of $P$

## Description

This method creates a TikZ-figure of the Hasse diagram of the given poset which can be included in a LaTeX file. The representation places the vertices on horizontal lines corresponding to the filtration of the poset. The only displayed edges are the coveringRelations which are oriented so that lower vertices less than higher vertices.

The method attempts to display labels in a sane way, if they are not suppressed by the SuppressLabels option. Note that the SuppressLabels option's default value can be set in the "~/.Macaulay2/init-Posets.m2" file.

Further, sometimes the vertices of the poset line up in unfortunate ways that causes edges to touch other vertices. Using the Jitter option can relieve this by adding a small random horizontal shift to each vertex.

    i1 : texPoset booleanLattice 2

    o1 = \begin{tikzpicture}[scale=1, vertices/.style={draw, fill=black, circle, inner sep=0pt}]
                 \node [vertices] (0) at (-0+0,0){};
                 \node [vertices] (1) at (-.75+0,1.33333){};
                 \node [vertices] (2) at (-.75+1.5,1.33333){};
                 \node [vertices] (3) at (-0+0,2.66667){};
         \foreach \to/\from in {0/1, 2/3, 0/2, 1/3}
         \draw [-] (\to)--(\from);
         \end{tikzpicture}

    i2 : texPoset(booleanLattice 2, Jitter => true)

    o2 = \begin{tikzpicture}[scale=1, vertices/.style={draw, fill=black, circle, inner sep=0pt}]
                 \node [vertices] (0) at (-0+.267814,0){};
                 \node [vertices] (1) at (-.75+.202018,1.33333){};
                 \node [vertices] (2) at (-.75+1.58819,1.33333){};
                 \node [vertices] (3) at (-0+.189883,2.66667){};
         \foreach \to/\from in {0/1, 2/3, 0/2, 1/3}
         \draw [-] (\to)--(\from);
         \end{tikzpicture}

## Caveat

Calling texPoset via the command tex expects that no options are given.

## See also

- coveringRelations -- computes the minimal list of generating relations of a poset
- displayPoset -- generates a PDF representation of a poset and attempts to display it
- filtration -- generates the filtration of a poset
- outputTexPoset -- writes a LaTeX file with a TikZ-representation of a poset

## Ways to use texPoset:

- `texPoset(Poset)`

## For the programmer

The object texPoset is a method function with options.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Posets.m2:4182:0.