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

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

Synopsis

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

Ways to use texPoset :

For the programmer

The object texPoset is a method function with options.