There are two operations TikzString
(18.4-1) and DotString
(18.2-1) in Semigroups for creating LaTeX and dot
(also known as GraphViz) format pictures of the Green's class structure of a semigroup and for visualising certain types of elements of a semigroup. There is also a function Splash
(18.1-1) for automatically processing the output of TikzString
(18.4-1) and DotString
(18.2-1) and opening the resulting pdf file.
In this section we describe the function Splash
(18.1-1) for automatically processing and opening the strings output by TikzString
(18.4-1) and DotString
(18.2-1)
‣ Splash ( str[, opts] ) | ( function ) |
Returns: Nothing.
This function attempts to convert the string str into a pdf document and open this document, i.e. to splash it all over your monitor.
The string str must correspond to a valid dot
or LaTeX
text file and you must have have GraphViz
and pdflatex
installed on your computer. For details about these file formats, see http://www.latex-project.org and http://www.graphviz.org.
This function is provided to allow convenient, immediate viewing of the pictures produced by the functions: TikzString
(18.4-1), TikzString
(18.4-1), DotSemilatticeOfIdempotents
(18.2-2), and DotString
(18.2-1).
The optional second argument opts should be a record with components corresponding to various options, given below.
this should be a string representing the path to the directory where you want Splash
to do its work. The default value of this option is "~/"
.
this should be a string representing the name of the directory in path
where you want Splash
to do its work. This function will create this directory if does not already exist.
The default value of this option is "tmp.viz"
if the option path
is present, and the result of DirectoryTemporary
(Reference: DirectoryTemporary) is used otherwise.
this should be a string representing the name of the file where str will be written. The default value of this option is "vizpicture"
.
this should be a string representing the name of the program which should open the files produced by GraphViz
or pdflatex
.
this option can be used to specify that the string str contains a LaTeX or dot
document. You can specify this option in str directly by making the first line "%latex"
or "//dot"
. There is no default value for this option, this option must be specified in str or in opt.type.
this should be a string representing the type of file which Splash
should produce. For LaTeX files, this option is ignored and the default value "pdf"
is used.
This function was written by Attila Egri-Nagy and Manuel Delgado with some minor changes by J. D. Mitchell.
gap> Splash(DotString(FullTransformationMonoid(4)));
dot
pictures
In this section, we describe the operations in Semigroups for creating pictures in dot
format.
The operations described in this section return strings, which can be written to a file using the function FileString
(GAPDoc: FileString) or viewed using Splash
(18.1-1).
‣ DotString ( S[, options] ) | ( operation ) |
Returns: A string.
If the argument S is a semigroup, and the optional second argument options is a record, then this operation produces a graphical representation of the partial order of the \(\mathscr{D}\)-classes of the semigroup S together with the eggbox diagram of each \(\mathscr{D}\)-class. The output is in dot
format (also known as GraphViz
) format. For details about this file format, and information about how to display or edit this format see http://www.graphviz.org.
The string returned by DotString
can be written to a file using the command FileString
(GAPDoc: FileString).
The \(\mathscr{D}\)-classes are shown as eggbox diagrams with \(\mathscr{L}\)-classes as rows and \(\mathscr{R}\)-classes as columns; group \(\mathscr{H}\)-classes are shaded gray and contain an asterisk. The \(\mathscr{L}\)-classes and \(\mathscr{R}\)-classes within a \(\mathscr{D}\)-class are arranged to correspond to the normalization of the principal factor given by NormalizedPrincipalFactor
(12.4-8). The \(\mathscr{D}\)-classes are numbered according to their index in GreensDClasses(S)
, so that an i
appears next to the eggbox diagram of GreensDClasses(S)[i]
. A line from one \(\mathscr{D}\)-class to another indicates that the higher \(\mathscr{D}\)-class is greater than the lower one in the \(\mathscr{D}\)-order on S.
If the optional second argument options is present, it can be used to specify some options for output.
if options.number
is false
, then the \(\mathscr{D}\)-classes in the diagram are not numbered according to their index in the list of \(\mathscr{D}\)-classes of S. The default value for this option is true
.
if options.maximal
is true
, then the structure description of the group \(\mathscr{H}\)-classes is displayed; see StructureDescription
(Reference: StructureDescription). Setting this attribute to true
can adversely affect the performance of DotString
. The default value for this option is false
.
if options.normal
is false
, then the \(\mathscr{L}\)- and \(\mathscr{R}\)-classes within each \(\mathscr{D}\)-class arranged to correspond to PrincipalFactor
(12.4-8). If options.normal
is true
, they are instead arranged to correspond to NormalizedPrincipalFactor
(12.4-8). Setting this attribute to false
may improve the performance of DotString
as it avoids the computation of InjectionNormalizedPrincipalFactor
(12.4-7). The default value for this option is true
.
gap> S := FullTransformationMonoid(3); <full transformation monoid of degree 3> gap> DotString(S); "//dot\ndigraph DClasses {\nnode [shape=plaintext]\nedge [color=blac\ k,arrowhead=none]\n1 [shape=box style=invisible label=<\n<TABLE BORDE\ R=\"0\" CELLBORDER=\"1\" CELLPADDING=\"10\" CELLSPACING=\"0\" PORT=\"\ 1\">\n<TR BORDER=\"0\"><TD COLSPAN=\"1\" BORDER = \"0\" > 1</TD></TR>\ <TR><TD BGCOLOR=\"gray\">*</TD></TR>\n</TABLE>>];\n2 [shape=box style\ =invisible label=<\n<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLPADDING=\ \"10\" CELLSPACING=\"0\" PORT=\"2\">\n<TR BORDER=\"0\"><TD COLSPAN=\"\ 3\" BORDER = \"0\" > 2</TD></TR><TR><TD BGCOLOR=\"gray\">*</TD><TD BG\ COLOR=\"gray\">*</TD><TD BGCOLOR=\"white\"></TD></TR>\n<TR><TD BGCOLO\ R=\"gray\">*</TD><TD BGCOLOR=\"white\"></TD><TD BGCOLOR=\"gray\">*</T\ D></TR>\n<TR><TD BGCOLOR=\"white\"></TD><TD BGCOLOR=\"gray\">*</TD><T\ D BGCOLOR=\"gray\">*</TD></TR>\n</TABLE>>];\n3 [shape=box style=invis\ ible label=<\n<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLPADDING=\"10\"\ CELLSPACING=\"0\" PORT=\"3\">\n<TR BORDER=\"0\"><TD COLSPAN=\"1\" BO\ RDER = \"0\" > 3</TD></TR><TR><TD BGCOLOR=\"gray\">*</TD></TR>\n<TR><\ TD BGCOLOR=\"gray\">*</TD></TR>\n<TR><TD BGCOLOR=\"gray\">*</TD></TR>\ \n</TABLE>>];\n1 -> 2\n2 -> 3\n }" gap> FileString("t3.dot", DotString(S)); 1040
‣ DotSemilatticeOfIdempotents ( S ) | ( attribute ) |
Returns: A string.
This function produces a graphical representation of the semilattice of the idempotents of an inverse semigroup S where the elements of S have a unique semigroup inverse accessible via Inverse
(Reference: Inverse). The idempotents are grouped by the \(\mathscr{D}\)-class they belong to.
The output is in dot
format (also known as GraphViz
) format. For details about this file format, and information about how to display or edit this format see http://www.graphviz.org.
gap> S := DualSymmetricInverseMonoid(4); <inverse block bijection monoid of degree 4 with 3 generators> gap> DotSemilatticeOfIdempotents(S); "//dot\ngraph graphname {\n node [shape=point]\nranksep=2;\nsubgraph \ cluster_1{\n15 \n}\nsubgraph cluster_2{\n5 11 14 12 13 8 \n}\nsubgraph\ cluster_3{\n2 10 6 3 4 9 7 \n}\nsubgraph cluster_4{\n1 \n}\n2 -- 1\n3\ -- 1\n4 -- 1\n5 -- 2\n5 -- 3\n5 -- 4\n6 -- 1\n7 -- 1\n8 -- 2\n8 -- 6\ \n8 -- 7\n9 -- 1\n10 -- 1\n11 -- 2\n11 -- 9\n11 -- 10\n12 -- 3\n12 -- \ 6\n12 -- 9\n13 -- 3\n13 -- 7\n13 -- 10\n14 -- 4\n14 -- 6\n14 -- 10\n15\ -- 5\n15 -- 8\n15 -- 11\n15 -- 12\n15 -- 13\n15 -- 14\n }"
tex
output
In this section, we describe the operations in Semigroups for creating LaTeX representations of GAP objects. For pictures of GAP objects please see Section 18.4.
‣ TexString ( f[, n] ) | ( operation ) |
Returns: A string.
This function produces a string containing LaTeX code for the transformation f. If the optional paramater n is used, then this is taken to be the degree of the transformation f, if the parameter n is not given, then DegreeOfTransformation
(Reference: DegreeOfTransformation) is used by default. If n is less than the degree of f, then an error is given.
gap> TexString(Transformation([6, 2, 4, 3, 6, 4])); "\\begin{pmatrix}\n 1 & 2 & 3 & 4 & 5 & 6 \\\\\n 6 & 2 & 4 & 3 & 6 &\ 4\n\\end{pmatrix}" gap> TexString(Transformation([1, 2, 1, 3]), 5); "\\begin{pmatrix}\n 1 & 2 & 3 & 4 & 5 \\\\\n 1 & 2 & 1 & 3 & 5\n\\en\ d{pmatrix}"
tikz
pictures
In this section, we describe the operations in Semigroups for creating pictures in tikz
format.
The functions described in this section return a string, which can be written to a file using the function FileString
(GAPDoc: FileString) or viewed using Splash
(18.1-1).
‣ TikzString ( obj[, options] ) | ( operation ) |
Returns: A string.
This function produces a graphical representation of the object obj using the tikz
package for LaTeX. More precisely, this operation outputs a string containing a minimal LaTeX document which can be compiled using LaTeX to produce a picture of obj.
Currently the following types of objects are supported:
If obj is the left or right blocks of a bipartition, then TikzString
returns a graphical representation of these blocks; see Section 3.6.
If obj is a bipartition, then TikzString
returns a graphical representation of obj.
If the optional second argument options is a record with the component colors
set to true
, then the blocks of f will be colored using the standard tikz
colors. Due to the limited number of colors available in tikz
this option only works when the degree of obj is less than 20. See Chapter 3 for more details about bipartitions.
If obj is a PBR, then TikzString
returns a graphical representation obj; see Section 3.6.
gap> x := Bipartition([[1, 4, -2, -3], [2, 3, 5, -5], [-1, -4]]);; gap> TikzString(RightBlocks(x)); "%tikz\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{documen\ t}\n\\begin{tikzpicture}\n \\draw[ultra thick](5,2)circle(.115);\n \ \\draw(1.8,5) node [top] {{$1$}};\n \\fill(4,2)circle(.125);\n \\dr\ aw(1.8,4) node [top] {{$2$}};\n \\fill(3,2)circle(.125);\n \\draw(1\ .8,3) node [top] {{$3$}};\n \\draw[ultra thick](2,2)circle(.115);\n \ \\draw(1.8,2) node [top] {{$4$}};\n \\fill(1,2)circle(.125);\n \\d\ raw(1.8,1) node [top] {{$5$}};\n\n \\draw (5,2.125) .. controls (5,2\ .8) and (2,2.8) .. (2,2.125);\n \\draw (4,2.125) .. controls (4,2.6)\ and (3,2.6) .. (3,2.125);\n\\end{tikzpicture}\n\n\\end{document}" gap> x := Bipartition([[1, 5], [2, 4, -3, -5], [3, -1, -2], [-4]]);; gap> TikzString(x); "%tikz\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{documen\ t}\n\\begin{tikzpicture}\n\n %block #1\n %vertices and labels\n \\\ fill(1,2)circle(.125);\n \\draw(0.95, 2.2) node [above] {{ $1$}};\n \ \\fill(5,2)circle(.125);\n \\draw(4.95, 2.2) node [above] {{ $5$}};\ \n\n %lines\n \\draw(1,1.875) .. controls (1,1.1) and (5,1.1) .. (5\ ,1.875);\n\n %block #2\n %vertices and labels\n \\fill(2,2)circle(\ .125);\n \\draw(1.95, 2.2) node [above] {{ $2$}};\n \\fill(4,2)circ\ le(.125);\n \\draw(3.95, 2.2) node [above] {{ $4$}};\n \\fill(3,0)c\ ircle(.125);\n \\draw(3, -0.2) node [below] {{ $-3$}};\n \\fill(5,0\ )circle(.125);\n \\draw(5, -0.2) node [below] {{ $-5$}};\n\n %lines\ \n \\draw(2,1.875) .. controls (2,1.3) and (4,1.3) .. (4,1.875);\n \ \\draw(3,0.125) .. controls (3,0.7) and (5,0.7) .. (5,0.125);\n \\dr\ aw(2,2)--(3,0);\n\n %block #3\n %vertices and labels\n \\fill(3,2)\ circle(.125);\n \\draw(2.95, 2.2) node [above] {{ $3$}};\n \\fill(1\ ,0)circle(.125);\n \\draw(1, -0.2) node [below] {{ $-1$}};\n \\fill\ (2,0)circle(.125);\n \\draw(2, -0.2) node [below] {{ $-2$}};\n\n %l\ ines\n \\draw(1,0.125) .. controls (1,0.6) and (2,0.6) .. (2,0.125);\ \n \\draw(3,2)--(2,0);\n\n %block #4\n %vertices and labels\n \\f\ ill(4,0)circle(.125);\n \\draw(4, -0.2) node [below] {{ $-4$}};\n\n \ %lines\n\\end{tikzpicture}\n\n\\end{document}" gap> TikzString(UniversalPBR(2)); "%latex\n\\documentclass{minimal}\n\\usepackage{tikz}\n\\begin{docume\ nt}\n\\usetikzlibrary{arrows}\n\\usetikzlibrary{arrows.meta}\n\\newco\ mmand{\\arc}{\\draw[semithick, -{>[width = 1.5mm, length = 2.5mm]}]}\ \n\\begin{tikzpicture}[\n vertex/.style={circle, draw, fill=black, i\ nner sep =0.04cm},\n ghost/.style={circle, draw = none, inner sep = \ 0.14cm},\n botloop/.style={min distance = 8mm, out = -70, in = -110}\ ,\n toploop/.style={min distance = 8mm, out = 70, in = 110}]\n\n % \ vertices and labels\n \\foreach \\i in {1,...,2} {\n \\node [vert\ ex] at (\\i/1.5, 3) {};\n \\node [ghost] (\\i) at (\\i/1.5, 3) {};\ \n }\n\n \\foreach \\i in {1,...,2} {\n \\node [vertex] at (\\i/\ 1.5, 0) {};\n \\node [ghost] (-\\i) at (\\i/1.5, 0) {};\n }\n\n \ % arcs from vertex 1\n \\arc (1) to (-2);\n \\arc (1) to (-1);\n \ \\arc (1) edge [toploop] (1);\n \\arc (1) .. controls (1.06666666666\ 66667, 2.125) and (0.93333333333333324, 2.125) .. (2);\n\n % arcs fr\ om vertex -1\n \\arc (-1) .. controls (1.0666666666666667, 0.875) an\ d (0.93333333333333324, 0.875) .. (-2);\n \\arc (-1) edge [botloop] \ (-1);\n \\arc (-1) to (1);\n \\arc (-1) to (2);\n\n % arcs from ve\ rtex 2\n \\arc (2) to (-2);\n \\arc (2) to (-1);\n \\arc (2) .. co\ ntrols (0.93333333333333324, 2.125) and (1.0666666666666667, 2.125) .\ . (1);\n \\arc (2) edge [toploop] (2);\n\n % arcs from vertex -2\n \ \\arc (-2) edge [botloop] (-2);\n \\arc (-2) .. controls (0.9333333\ 3333333324, 0.875) and (1.0666666666666667, 0.875) .. (-1);\n \\arc \ (-2) to (1);\n \\arc (-2) to (2);\n\n\\end{tikzpicture}\n\\end{docum\ ent}"
generated by GAPDoc2HTML