This chapter consists of two sections, the first of which decribes the main function of the package. The second one can be thought just as an example to produce a table where the integers appear ordered in a non standard way.

The function `IP_TikzArrayOfIntegers`

(2.1-1) is the main function of the IntPic package. It aims to produce `tikz`

code for displaying arrays of integers.

`‣ IP_TikzArrayOfIntegers` ( arg ) | ( function ) |

The arguments (at most 3) are:

(optional)

a table of integers. In this case, the length of the rows is the maximum of the lengths of the sublists in the table,

*or*a list of integers and, optionally, an integer which indicates the length of the rows; when the length of the rows is not indicated, a compromise between the width and the height is tried.

a record of options. One of the fields of this record, named

`highlights`

, is an array whose entries are the numbers to be highlighted: one color per sublist. See details and other options in ChapterĀ 5.

When no list nor table is present, the smallest range containing all the integers to be highlighted is taken.

gap> rg := [81..89];; gap> len := 10;; gap> arr := [Filtered(rg,IsPrime),Filtered(rg,u->(u mod 2)=0), > Filtered(rg,u->(u mod 3)=0)];; gap> tkz := IP_TikzArrayOfIntegers(rg,len,rec(highlights:=arr));;

The aspect of the string `tkz` produced is not very appealing. We show it once, by asking it exlicitly in the next example. In the forthcomming examples we keep using two semicolons to avoid showing this kind of strings.

gap> tkz; "%tikz\n\\begin{tikzpicture}[every node/.style={draw,scale=1pt,\nminimum width\ =20pt,inner sep=3pt,\nline width=1pt,draw=black}]\n\\matrix[row sep=2pt,column\ sep=2pt]\n{\\node[fill=-red]{86};&\n\\node[fill=green]{87};&\n\\node[fill=-re\ d]{88};&\n\\node[fill=red]{89};\\\\\n\\node[fill=green]{81};&\n\\node[fill=-re\ d]{82};&\n\\node[fill=red]{83};&\n\\node[left color=-red,right color=green]{84\ };&\n\\node[]{85};\\\\\n};\n\\end{tikzpicture}\n"

This string can be used at the users wish. In particular, it can be sent to the standard output using the command `Print`

(Reference: Print).

gap> Print(tkz); %tikz \begin{tikzpicture}[every node/.style={draw,scale=1pt, minimum width=20pt,inner sep=3pt, line width=1pt,draw=black}] \matrix[row sep=2pt,column sep=2pt] {\node[fill=-red]{86};& \node[fill=green]{87};& \node[fill=-red]{88};& \node[fill=red]{89};\\ \node[fill=green]{81};& \node[fill=-red]{82};& \node[fill=red]{83};& \node[left color=-red,right color=green]{84};& \node[]{85};\\ }; \end{tikzpicture}

It can now be copied and pasted in a LaTeX document (having the appropriate packages in the preamble). See Chapter 4 for details and alternatives.

The next function uses the previous one, but is called with a simpler argument. It will hopefully be useful for simple drawings. The length of each row and the umber of columns varies. A compromise based on some experiments has been established in order to obtain not too large nor too high images.

`‣ IP_SimpleTikzArrayOfIntegers` ( arg ) | ( function ) |

The argument is either a list of integers or a matrix of integers. The integers involved are embeded in a range `rg` of minimum length and highlighted by using the list of default colors.

gap> d := DivisorsInt(30); [ 1, 2, 3, 5, 6, 10, 15, 30 ] gap> IP_SimpleTizkArrayOfIntegers(d);;

gap> d30 := DivisorsInt(30); [ 1, 2, 3, 5, 6, 10, 15, 30 ] gap> d40 := DivisorsInt(40); [ 1, 2, 4, 5, 8, 10, 20, 40 ] gap> tkz := IP_SimpleTizkArrayOfIntegers([d30,d40]);;

When the user is interested in tables of a certain kind, it may be a good idea to write some code to produce these tables. The following function (whose code is part of the file *ip_tables.gi* in the *gap* folder of this package) is convenient to deal with numerical semigroups with two generators and has been used to produce the images contained in [DFGL14].

`‣ IP_TableWithModularOrder` ( o, a, b, depth, height, rep, pos ) | ( function ) |

The arguments `rep` and `pos` are booleans (`true`

or `false`

). When `rep` is `true`

there is some repetition: the last column is equal to the first, but pushed down some rows. When `pos` is `true`

, no rows below 0 are considered, (contradicting `depth`, if needed).

The first five arguments arguments `o, a, b,depth` and `height` are integers. What they represent is described in what follows. There is assigned some kind of a referential on the constructed table and the fist argument, `o`, stands for the origin. A table with `b` columns (`b`+1 columns when `rep` is `true`

) is constructed as follows. The row containing the origin is

`o`+ [0..`b`-1]*`a`, if`rep`is`false`

,*or*`o`+ [0..`b`]*`a`, if`rep`is`true`

The remaining rows are obtained by adding `b` (the upper ones) or subtracting `b` (the others) to these rows.

Note: when `a` < `b` are co-prime, this construction provides a representation of the integers as an array.

gap> a := 8;; b := 19;; gap> ns := NumericalSemigroup(a,b);; gap> c := ConductorOfNumericalSemigroup(ns);; gap> origin := 2*c-1; 251 gap> ground := [origin..origin+b-1];; gap> gap> height:=2;; gap> depth:=8;; gap> xaxis := [origin];; gap> for n in [1..b-1] do > Add(xaxis, origin+n*a); > od; gap> yaxis := [];; gap> for n in [-depth..height] do > Add(yaxis, origin+n*b); > od; gap> gap> table := TableWithModularOrder(origin,a,b,depth,height,false,false);; gap> arr := [xaxis,yaxis,ground]; [ [ 251, 259, 267, 275, 283, 291, 299, 307, 315, 323, 331, 339, 347, 355, 363, 371, 379, 387, 395 ], [ 99, 118, 137, 156, 175, 194, 213, 232, 251, 270, 289 ], [ 251 .. 269 ] ] gap> tkz:=IP_TikzArrayOfIntegers(table,rec(highlights:=arr));;

The next picture is obtained in the same way. The information that only the shape has interest is given by including the option

`shape_only:=" "`

. The variable `tkz`

should be defined in a similar manner to the following one.
gap> tkz:=IP_TikzArrayOfIntegers(table,rec(highlights:=arr,shape_only:=" ", > cell_width := "6",colsep:="1",rowsep:="1",inner_sep:="2", > line_color:="black!20"));;

Next, a minimum of changes, just to illustrate the effect of

gap> table := TableWithModularOrder(origin,a,b,depth,50,true,true);; gap> tkz:=IP_TikzArrayOfIntegers(table,rec(highlights:=arr));;

generated by GAPDoc2HTML