Commits

mdelgado  committed 90f3515 Draft

first push

  • Participants

Comments (0)

Files changed (28)

+syntax: glob
+*.DS_Store
+*.aux
+*.log
+*.out
+*.blg
+*.bbl
+*.top
+*.pdf
+*.tui
+*.swp
+*.txt
+*.html
+*.brf
+*.idx
+*.ilg
+*.ind
+*.pnr
+*.toc
+*.six
+*.orig
+*.synctex.gz
+*.swp
+viz.tex
+#############################################################################
+##
+#W  CHANGELOG        SmallGenusNS - a GAP library of num. spps of small genus
+#Y  Copyright (C) 2012-...                                     Manuel Delgado
+##
+##  Licensing information can be found in the README file of this package.
+##
+#############################################################################
+##
+
+=============
+ Version 0.0.0  (29/01/12)
+=============
+
+  - first steps in producing the package
+We follow the conventions used in the VIZ package

File PackageInfo.g

+#############################################################################
+##
+#W  PackageInfo.g
+#Y  Copyright (C) 2012                                Manuel Delgado
+##
+##  Licensing information can be found in the README file of this package.
+##
+#############################################################################
+##
+
+##  <#GAPDoc Label="PKGVERSIONDATA">
+##  <!ENTITY VERSION "0.0.1">
+##  <!ENTITY RELEASEDATE "1 July 2012">
+##  <#/GAPDoc>
+
+SetPackageInfo( rec(
+
+PackageName := "integersem",
+
+Subtitle := "A GAP package to emphasize subsets of integers",
+
+Version := "0.0.1",
+
+Date := "06/06/2012",
+        
+ArchiveURL := "https://bitbucket.org/mdelgado/integersem",
+
+ArchiveFormats := ".tar.gz",
+
+Persons := [
+ rec( 
+    LastName      := "Delgado",
+    FirstNames    := "Manuel",
+    IsAuthor      := true,
+    IsMaintainer  := true,
+    Email         := "mdelgado@fc.up.pt",
+    WWWHome       := "http://www.fc.up.pt/cmup/mdelgado",
+    PostalAddress := Concatenation( [
+                       "University of Porto\n",
+                       "Portugal" ] ),
+    Place         := "Porto, Portugal",
+    Institution   := "University of Porto"
+  ),
+],
+
+Status := "dev",
+
+README_URL := 
+"http://www.fc.up.pt/cmup/mdelgado/integersem/README",
+PackageInfoURL := 
+"http://www.fc.up.pt/cmup/mdelgado/integersem/PackageInfo.g",
+
+AbstractHTML := 
+  "<span class=\"pkgname\">IntegersEm</span> is a <span class=\"pkgname\">GAP</span> package \
+   package for emphasizing subsets of integers.",
+
+PackageWWWHome := "http://www.fc.up.pt/cmup/mdelgado/integersem",
+
+PackageDoc := rec(
+  BookName  := "IntegersEm",
+  Archive :=  "http://www.fc.up.pt/cmup/mdelgado/integersem",
+
+  ArchiveURLSubset := ["htm"],
+  HTMLStart := "doc/manual.htm",
+  PDFFile   := "doc/manual.pdf",
+  SixFile   := "doc/manual.six",
+  LongTitle := "Emphasizing subsets of integers",
+  Autoload  := true
+),
+
+Dependencies := rec(
+ GAP := ">=4.5",
+ NeededOtherPackages := [["GAPDoc", "1.4"]],
+ SuggestedOtherPackages := [["viz", "0.2.5"] ],
+ ExternalConditions := [], 
+),
+
+AvailabilityTest := ReturnTrue,
+
+Autoload := false,
+
+TestFile := "test/test.g",
+
+Keywords := ["emphasizing", "highlighting", "integers"]
+));
+
+##############################  the banner ##############################
+# The code used to produce the banner. It may be used as an example, provided
+# that you have the "viz" and the "integersem" packages installed. 
+LoadPackage("viz");
+LoadPackage("integersem");
+
+n:=3300;
+flen := 110;#the length of each row
+rg := [1..n];;
+primes := Filtered(rg,i->IsPrime(i));
+twins := Filtered(primes, p -> IsPrime(p+2)); #A list consisting of the first
+#elements of pairs of twin primes  
+rgnp := Difference(rg,primes);
+arr := [primes,
+[1],
+Union(twins,twins+2),
+# now the non primes...
+Filtered(rgnp,u->(u mod 2)=0),
+Filtered(rgnp,u->(u mod 3)=0),
+Filtered(rgnp,u->(u mod 5)=0),
+[],[], # to avoid some colors
+Filtered(rgnp,u->(u mod 7)=0),
+Filtered(rgnp,u->(u mod 11)=0),
+Filtered(rgnp,u->(u mod 13)=0),
+Filtered(rgnp,u->(u mod 17)=0),
+Filtered(rgnp,u->(u mod 19)=0),
+Filtered(rgnp,u->(u mod 23)=0),
+Filtered(rgnp,u->(u mod 29)=0),
+Filtered(rgnp,u->(u mod 31)=0),
+Filtered(rgnp,u->(u mod 37)=0),
+Filtered(rgnp,u->(u mod 41)=0),
+Filtered(rgnp,u->(u mod 43)=0),
+Filtered(rgnp,u->(u mod 47)=0),
+Filtered(rgnp,u->(u mod 53)=0)];
+
+TikzArrayOfIntegers(rg,flen,rec(cell_width := "27",highlights:=arr));;
+SetInfoLevel(InfoViz,1);
+Splash(last,rec(latexpoints:="10pt",papersize:="a0paper",viewer:="okular"));
+
+n:=1000;
+flen := 50;#the length of each row
+rg := [1..n];;
+primes := Filtered(rg,i->IsPrime(i));
+twins := Filtered(primes, p -> IsPrime(p+2)); #A list consisting of the first
+#elements of pairs of twin primes  
+rgnp := Difference(rg,primes);
+arr := [primes,
+[1],
+Union(twins,twins+2)];
+
+TikzArrayOfIntegers(rg,flen,rec(cell_width := "27",highlights:=arr));;
+SetInfoLevel(InfoViz,1);
+Splash(last,rec(latexpoints:="10pt",papersize:="a0paper",viewer:="okular"));

File doc/IntegersEm.bib

+@manual{DelgadoEgri-NagyMitchellPfeiffer2012-Viz,
+  title = {Viz - a GAP package for drawing GAP objects},
+  author = {Delgado, M. and Egri-Nagy, A. and Mitchell, J.~D. and Pfeiffer, M.},
+  year = {2012},
+  note = {Under development},
+  url = {https://bitbucket.org/zen154115/viz}
+}
+@manual{DelgadoLintonMorais:automata,
+  title = {Automata -- a {GAP} package on automata},
+  author = {Delgado, M. and Linton, S. and Morais, J.},
+  note = {Version number 1.12},
+  url = {http://www.gap-system.org/Packages/automata.html}
+}
+@manual{DelgadoMorais:sgpviz,
+  title = {SgpViz -- a user-friendly {GAP} package to deal with semigroups},
+  author = {Delgado, M. and Morais, J.},
+  month = {May},
+  year = {2008},
+  note = {Version number 0.998},
+  url = {http://www.gap-system.org/Packages/sgpviz.html}
+}

File doc/IntegersEm.tex

+% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
+\documentclass[a4paper,11pt]{report}
+\usepackage{pgf}
+\usepackage{tikz}
+\usepgfmodule{plot}
+\usepgflibrary{plothandlers}
+\usetikzlibrary{shapes.geometric}
+\usetikzlibrary{shadings}
+\usepackage{a4wide}
+\sloppy
+\pagestyle{myheadings}
+\usepackage{amssymb}
+\usepackage[latin1]{inputenc}
+\usepackage{makeidx}
+\makeindex
+\usepackage{color}
+\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
+\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
+\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
+\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
+\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
+\definecolor{Black}{rgb}{0.0,0.0,0.0}
+
+\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
+\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
+\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
+\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
+\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
+\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
+\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
+\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}
+
+%%  for a long time these were red and blue by default,
+%%  now black, but keep variables to overwrite
+\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
+%% strange name because of pdflatex bug:
+\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
+\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}
+
+
+\usepackage{fancyvrb}
+
+\usepackage{mathptmx,helvet}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+
+
+\usepackage[
+            pdftex=true,
+            bookmarks=true,        
+            a4paper=true,
+            pdftitle={Written with GAPDoc},
+            pdfcreator={LaTeX with hyperref package / GAPDoc},
+            colorlinks=true,
+            backref=page,
+            breaklinks=true,
+            linkcolor=linkColor,
+            citecolor=citeColor,
+            filecolor=fileColor,
+            urlcolor=urlColor,
+            pdfpagemode={UseNone}, 
+           ]{hyperref}
+
+\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}
+
+% write page numbers to a .pnr log file for online help
+\newwrite\pagenrlog
+\immediate\openout\pagenrlog =\jobname.pnr
+\immediate\write\pagenrlog{PAGENRS := [}
+\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
+%% were never documented, give conflicts with some additional packages
+
+\newcommand{\GAP}{\textsf{GAP}}
+
+%% nicer description environments, allows long labels
+\usepackage{enumitem}
+\setdescription{style=nextline}
+
+%% depth of toc
+\setcounter{tocdepth}{1}
+
+
+
+
+
+%% command for ColorPrompt style examples
+\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
+\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
+\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}
+
+
+\begin{document}
+
+\logpage{[ 0, 0, 0 ]}
+\begin{titlepage}
+\mbox{}\vfill
+
+\begin{center}{\maintitlesize \textbf{\textsf{IntegersEm}\mbox{}}}\\
+\vfill
+
+\hypersetup{pdftitle=\textsf{IntegersEm}}
+\markright{\scriptsize \mbox{}\hfill \textsf{IntegersEm} \hfill\mbox{}}
+{\Huge \textbf{A \textsf{GAP} package for visualizing sets of integers\mbox{}}}\\
+\vfill
+
+{\Huge Version 0.0.1\mbox{}}\\[1cm]
+{1 July 2012\mbox{}}\\[1cm]
+\mbox{}\\[2cm]
+{\Large \textbf{Manuel Delgado   \mbox{}}}\\
+\hypersetup{pdfauthor=Manuel Delgado   }
+\end{center}\vfill
+
+\mbox{}\\
+{\mbox{}\\
+\small \noindent \textbf{Manuel Delgado   }  Email: \href{mailto://mdelgado@fc.up.pt} {\texttt{mdelgado@fc.up.pt}}\\
+  Homepage: \href{http://cmup.fc.up.pt/cmup/mdelgado/} {\texttt{http://cmup.fc.up.pt/cmup/mdelgado/}}}\\
+\end{titlepage}
+
+\newpage\setcounter{page}{2}
+{\small 
+\section*{Copyright}
+\logpage{[ 0, 0, 1 ]}
+ \index{License} {\copyright} 2012 M. Delgado
+
+ \noindent \textsf{IntegersEm} package is free software; you can redistribute it and/or modify it under the
+terms of the \href{http://www.fsf.org/licenses/gpl.html} {GNU General Public License} as published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version. \mbox{}}\\[1cm]
+{\small 
+\section*{Acknowledgements}
+\logpage{[ 0, 0, 3 ]}
+ The author was partially funded by the European Regional Development Fund
+through the program COMPETE and by the Portuguese Government through the FCT -
+Funda{\c c}{\~a}o para a Ci{\^e}ncia e a Tecnologia under the project
+PEst-C/MAT/UI0144/2011. 
+
+ He benefited also of the sabbatical grant SFRH/BSAB/1156/2011. 
+
+ Furthermore, I want to thank my colleagues of the Mathematics Department of
+the Faculty of Sciences of the University of Porto for the opportunity of
+taking a sabbatical year during the 2011/2012 school year. 
+
+ For one reason or another that ranges from suggestions to encouragement, I
+want express my gratitude to Pedro A. Garc{\a'\i}a S{\a'a}nchez, David Llena
+and James Mitchel. \mbox{}}\\[1cm]
+{\small 
+\section*{Colophon}
+\logpage{[ 0, 0, 2 ]}
+ This manual describes the \textsf{GAP} 4.5 package \textsf{IntegersEm} version 0.0.1 for visualising sets of integers. \mbox{}}\\[1cm]
+\newpage
+
+\def\contentsname{Contents\logpage{[ 0, 0, 4 ]}}
+
+\tableofcontents
+\newpage
+
+ 
+\chapter{\textcolor{Chapter }{The \textsf{IntegersEm} package}}\label{intro}
+\logpage{[ 1, 0, 0 ]}
+\hyperdef{L}{X8517A0D6798FE3FF}{}
+{
+  \index{\textsf{IntegersEm} - Overview} 
+\section{\textcolor{Chapter }{Overview and Introduction}}\logpage{[ 1, 1, 0 ]}
+\hyperdef{L}{X87F9EA0A83C0DC65}{}
+{
+ The \textsf{IntegersEm} package has two main goals: 
+\begin{itemize}
+\item Provide an immediate visualization of subsets of sets of integers
+\item Produce Tikz code to be included in a LaTeX file.
+\end{itemize}
+ The drawing is done by producing some text representation (dot or tikz code)
+which is then processed by external tools.
+
+  This package grew up from the author's will to have a pictorial view of some
+sets of integers. Effort has then been made to serve a slightly more general
+purpose. For instance, if the user wants to have a pictorial idea of how many
+primes there are between 800 and 1000, or show it to his students and,
+perhaps, which among these primes are twin primes, he will probably be happy
+by producing a picture like the following 
+
+  \begin{center} \input{images/primesandtwins.tex} \end{center}   
+
+ It has clearly too much information, given through the different colors. The
+twin primes are in red-green, while the other primes are in red. 
+
+ This package contains relatively few lines of code. The heavy part is the
+manual, where many examples are presented. 
+
+ The design of the code greatly benefits from my long experience on producing
+visualisation tools for \textsf{GAP} objects. The package \textsf{sgpviz} \cite{DelgadoMorais:sgpviz} is the visible part. More recently, I got involved in a more general project,
+the \textsf{viz} package \cite{DelgadoEgri-NagyMitchellPfeiffer2012-Viz}. The experience gained there, especially through long and fruitfull
+discussions with J. Mitchell, has greatly influenced. This package will
+eventually be part of that project. For the moment, it is independent, but its
+results may be better appreciated if \textsf{viz} is installed. 
+
+ The package produces tikz od dot code that the user may then use at his wish.
+In particular, can use it in publications. But prior to obtaining results that
+lead to a publication, the user may benefit of viewing thousands of images.
+There is a function in \textsf{viz} that is intended to make this task easy. It is intended to be almost platform
+independent. It bennefits from the \textsf{GAP} stuff on creating a temporary directory where the computations occur. The
+cleaning task is also left to \textsf{GAP}, wich leaves the user free of the need of collecting the garbage. \texttt{graphviz} (see \href{http://www.graphviz.org/} {\texttt{http://www.graphviz.org/}}), or \texttt{LaTeX} together with some packages, in particular, the \texttt{Tikz} package, must be installed. 
+
+ This package consists basically of a function with many options associated.
+The purpose of the manual is to illustrate the use of the options. }
+
+  
+\section{\textcolor{Chapter }{Installing \textsf{IntegersEm}}}\label{install}
+\logpage{[ 1, 2, 0 ]}
+\hyperdef{L}{X7EB23B848148B483}{}
+{
+  In this section we give a brief description of how to start using \textsf{IntegersEm}. If you have any problems getting \textsf{IntegersEm} working, then you could try emailling me at \href{mailto://mdelgado@fc.up.pt} {\texttt{mdelgado@fc.up.pt}}. 
+
+  It is assumed that you have a working copy of \textsf{GAP} with version number 4.5 or higher. The most up-to-date version of \textsf{GAP} and instructions on how to install it can be obtained from the main \textsf{GAP} webpage \vspace{\baselineskip}
+
+ \noindent\vspace{\baselineskip} \href{http://www.gap-system.org} {\texttt{http://www.gap-system.org}}
+
+ \noindent If the \textsf{IntegersEm} package was obtained as a part of the \textsf{GAP} distribution from the ``Download'' section of the \textsf{GAP} website, you may proceed to Section \ref{loading}. Alternatively, the \textsf{IntegersEm} package may be installed using a separate archive, for example, for an update
+or an installation in a non-default location (see  (\textbf{Reference: GAP Root Directories})). 
+
+ Below we describe the installation procedure for the \texttt{.tar.gz} archive format, which can be obtained from \vspace{\baselineskip}
+
+ \noindent\vspace{\baselineskip}\href{http://cmup.fc.up.pt/cmup/mdelgado/integersem/ } {\texttt{http://cmup.fc.up.pt/cmup/mdelgado/integersem/ }}. Installation using other archive formats is performed in a similar way. 
+
+ To install the \textsf{IntegersEm} package, unpack the archive file, which should have a name of form \texttt{integersem-\mbox{\texttt{\mdseries\slshape XXX}}.tar.gz} for some version number \mbox{\texttt{\mdseries\slshape XXX}}, by typing 
+
+ {\nobreakspace}{\nobreakspace}\texttt{gzip -dc integersem-\mbox{\texttt{\mdseries\slshape XXX}}.tar.gz | tar xpv} 
+
+ It may be unpacked in one of the following locations: 
+\begin{itemize}
+\item  in the \texttt{pkg} directory of your \textsf{GAP}{\nobreakspace}4 installation; 
+\item  or in a directory named \texttt{.gap/pkg} in your home directory (to be added to the \textsf{GAP} root directory unless \textsf{GAP} is started with \texttt{-r} option); 
+\item  or in a directory named \texttt{pkg} in another directory of your choice (e.g.{\nobreakspace}in the directory \texttt{mygap} in your home directory). 
+\end{itemize}
+ In the latter case one one must start \textsf{GAP} with the \texttt{-l} option, e.g.{\nobreakspace}if your private \texttt{pkg} directory is a subdirectory of \texttt{mygap} in your home directory you might type: 
+
+ {\nobreakspace}{\nobreakspace}\texttt{gap -l ";\mbox{\texttt{\mdseries\slshape myhomedir}}/mygap"} 
+
+ where \mbox{\texttt{\mdseries\slshape myhomedir}} is the path to your home directory, which may be replaced by a tilde (the
+empty path before the semicolon is filled in by the default path of the \textsf{GAP}{\nobreakspace}4 home directory). }
+
+  
+\section{\textcolor{Chapter }{Loading the IntegersEm Package}}\label{loading}
+\logpage{[ 1, 3, 0 ]}
+\hyperdef{L}{X83EFAD007E668975}{}
+{
+  To use the \textsf{IntegersEm} Package you have to request it explicitly. This is done by calling \texttt{LoadPackage} (\textbf{Reference: LoadPackage}): 
+
+ 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  !gapprompt@gap>| !gapinput@LoadPackage("integersem");|
+  ----------------------------------------------------------------
+  Loading  integersem 0.0.1 (Highlighting sets of integers)
+  by Manuel Delgado (http://www.fc.up.pt/cmup/mdelgado).
+  Homepage: http://www.fc.up.pt/cmup/mdelgado/integersem
+  ----------------------------------------------------------------
+  true
+\end{Verbatim}
+ 
+
+ If \textsf{GAP} cannot find a working binary, the call to \texttt{LoadPackage} will still succeed but a warning is issued informing that the \texttt{HelloWorld()} function will be unavailable. 
+
+ If you want to load the \textsf{IntegersEm} package by default, you can put the \texttt{LoadPackage} command into your \texttt{gaprc} file (see Section{\nobreakspace} (\textbf{Reference: The gap.ini and gaprc files})). }
+
+ 
+\section{\textcolor{Chapter }{Compiling the documentation}}\label{doc}
+\logpage{[ 1, 4, 0 ]}
+\hyperdef{L}{X7E61798C7D949C4E}{}
+{
+ To compile the documentation see \texttt{IntegersEmMakeDoc} (\ref{IntegersEmMakeDoc}). If you want to use the help system it is essential that you compile the
+documentation. 
+\subsection{\textcolor{Chapter }{Compiling the documentation}}\logpage{[ 1, 4, 1 ]}
+\hyperdef{L}{X7E61798C7D949C4E}{}
+{
+\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{IntegersEmMakeDoc({\mdseries\slshape })\index{IntegersEmMakeDoc@\texttt{IntegersEmMakeDoc}}
+\label{IntegersEmMakeDoc}
+}\hfill{\scriptsize (function)}}\\
+
+
+ Compiles the documentation. }
+
+ }
+
+ }
+
+ 
+\chapter{\textcolor{Chapter }{The \textsf{IntegersEm} package functions}}\label{functions}
+\logpage{[ 2, 0, 0 ]}
+\hyperdef{L}{X876976637FC1F1A6}{}
+{
+  
+\section{\textcolor{Chapter }{Functions}}\logpage{[ 2, 1, 0 ]}
+\hyperdef{L}{X86FA580F8055B274}{}
+{
+ 
+\subsection{\textcolor{Chapter }{Tikz code for arrays}}\logpage{[ 2, 1, 1 ]}
+\hyperdef{L}{X7B55AECD79E30712}{}
+{
+\noindent\textcolor{FuncColor}{$\triangleright$\ \ \texttt{TikzArrayOfIntegers({\mdseries\slshape arg})\index{TikzArrayOfIntegers@\texttt{TikzArrayOfIntegers}}
+\label{TikzArrayOfIntegers}
+}\hfill{\scriptsize (function)}}\\
+
+
+ This function aims to produce tikz code for displaying arrays of integers. 
+
+ Input: the arguments (at most 3) are: a range or a table of integers, an
+integer (indicating the length of the floors; it is only needed when a range
+is given as first argument. a record of options. For details on these see the
+default options... }
+
+ 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  !gapprompt@gap>| !gapinput@rg := [81..99];;|
+  !gapprompt@gap>| !gapinput@len := 10;;|
+  !gapprompt@gap>| !gapinput@arr := [Primes,Filtered(rg,u->(u mod 2)=0),Filtered(rg,u->(u mod 3)=0)];;|
+  !gapprompt@gap>| !gapinput@tkz := TikzArrayOfIntegers(rg,len,rec(highlights:=arr));;|
+\end{Verbatim}
+ tkz is a string that can be used at the user wish. In paricular, to the
+standard output using the command \texttt{Print} (\textbf{Reference: Print}). 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  !gapprompt@gap>| !gapinput@Print(tkz);|
+  %tikz
+  \begin{tikzpicture}
+  \matrix[row sep=2pt,column sep=2pt]
+  {\node[minimum width=20pt,draw]{91};&
+  \node[minimum width=20pt,draw,fill=green]{92};&
+  \node[minimum width=20pt,draw,fill=blue]{93};&
+  \node[minimum width=20pt,draw,fill=green]{94};&
+  \node[minimum width=20pt,draw]{95};&
+  \node[minimum width=20pt,draw,left color=green,right color=blue]{96};&
+  ## several more lines ##
+  \node[minimum width=20pt,draw,fill=green]{88};&
+  \node[minimum width=20pt,draw,fill=red]{89};&
+  \node[minimum width=20pt,draw,left color=green,right color=blue]{90};\\
+  };
+  \end{tikzpicture}
+  !gapprompt@gap>| !gapinput@|
+\end{Verbatim}
+ Or it can be printed into a file by using the command \texttt{PrintTo} (\textbf{Reference: PrintTo}). Then it can be processed using {\LaTeX} once you put in the preamble something like 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  \usepackage[x11names, rgb]{xcolor}
+  \usepackage{pgf}
+  \usepackage{tikz}
+  \usepgfmodule{plot}
+  \usepgflibrary{plothandlers}
+  \usetikzlibrary{shapes.geometric}
+  \usetikzlibrary{shadings}
+\end{Verbatim}
+ The picture obtained is the following  \begin{center} \input{81to99.tex} \end{center}   
+
+ Alternatively, if you have the \textsf{viz} package installed, you may do the following: 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  Splash(tkz);
+\end{Verbatim}
+ A picture is poped up. To know which is the temporary directory used you
+should set the info level \texttt{InfoViz} to $1$ or more. The following example illustrates the use of some options of the \texttt{splash} (\textbf{Viz: Splash}) of the \textsf{viz} package. Setting the option \texttt{papersize} to "a0paper" may be convenient for the visualisation of large images. The pdf
+viewer can also be changed. 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  !gapprompt@gap>| !gapinput@SetInfoLevel(InfoViz,1);|
+  !gapprompt@gap>| !gapinput@Splash(tkz,rec(latexpoints:="10pt",papersize:="a0paper",viewer:="okular")); |
+  #I  The temporary directory used is: /tmp/tmJcpphI/
+\end{Verbatim}
+ The temporary directory /tmp/tmJcpphI/ contains the files vizpicture1.tex and
+vizpicture.tex. The file vizpicture1.tex contains the tikz code (and can be
+copied to any other place) and the file vizpicture.tex is the {\LaTeX} document to be processed. Other files, namely the \texttt{vizpicture.pdf} are created by the \texttt{pdflatex} command that is called by the \texttt{splash} (\textbf{Viz: Splash}) function. }
+
+ }
+
+ 
+\chapter{\textcolor{Chapter }{Examples of use of the \textsf{IntegersEm} package}}\label{examples}
+\logpage{[ 3, 0, 0 ]}
+\hyperdef{L}{X7A27B1017EEEADFB}{}
+{
+  \index{\textsf{IntegersEm} - Examples} 
+\section{\textcolor{Chapter }{Examples}}\logpage{[ 3, 1, 0 ]}
+\hyperdef{L}{X7A489A5D79DA9E5C}{}
+{
+ The following example produces a picture containing the odd integers from $801$ to $999$. Each line (except the highest) contains $15$ cells. 
+\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
+  !gapprompt@gap>| !gapinput@rg := Filtered([801..999],u->(u mod 2)<>0);;|
+  !gapprompt@gap>| !gapinput@flen := 15;;|
+  !gapprompt@gap>| !gapinput@twins := Filtered(Primes, p -> p + 2 in Primes);; |
+  !gapprompt@gap>| !gapinput@arr := [Primes,Union(aux,aux+2),Filtered(rg,u->(u mod 3)=0)];;|
+  !gapprompt@gap>| !gapinput@TikzArrayOfIntegers(rg,flen,rec(allow_adjust_cell_width := "5",|
+  !gapprompt@>| !gapinput@highlights:=arr));;|
+  !gapprompt@gap>| !gapinput@Splash(last);|
+\end{Verbatim}
+ The picture obtained highlights the primes (red), the twin primes (green) and
+the multiples of $3$. It is as follows:  \begin{center} \input{primesandtwinsamongodd.tex} \end{center}   
+
+ }
+
+ }
+
+ 
+\chapter{\textcolor{Chapter }{The \textsf{IntegersEm} package options}}\label{options}
+\logpage{[ 4, 0, 0 ]}
+\hyperdef{L}{X7E8FC49782BC58EC}{}
+{
+  
+\section{\textcolor{Chapter }{Configuration Options}}\logpage{[ 4, 1, 0 ]}
+\hyperdef{L}{X7C1F2E6D860DBDEC}{}
+{
+ The configurable options can be set in \texttt{config} file in the main directory of the package. 
+\begin{itemize}
+\item  ...
+\end{itemize}
+ }
+
+ }
+
+ \def\bibname{References\logpage{[ "Bib", 0, 0 ]}
+\hyperdef{L}{X7A6F98FD85F02BFE}{}
+}
+
+\bibliographystyle{alpha}
+\bibliography{IntegersEm}
+
+\addcontentsline{toc}{chapter}{References}
+
+\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}
+\hyperdef{L}{X83A0356F839C696F}{}
+}
+
+\cleardoublepage
+\phantomsection
+\addcontentsline{toc}{chapter}{Index}
+
+
+\printindex
+
+\newpage
+\immediate\write\pagenrlog{["End"], \arabic{page}];}
+\immediate\closeout\pagenrlog
+\end{document}

File doc/IntegersEm.xml

+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Reading PKGVERSIONDATA chunk from the PackageInfo.g file -->
+
+<!DOCTYPE Book SYSTEM "gapdoc.dtd"
+   [<!ENTITY IntegersEm "<Package>IntegersEm</Package>">
+   <!ENTITY Numericalsgps "<Alt Not='Text'><URL
+   Text='Numericalsgps'>http://www.fc.up.pt/cmup/mdelgado/numericalsgps</URL></Alt><Alt
+   Only='Text'><Package>Numericalsgps</Package></Alt>">
+   <#Include Label="PKGVERSIONDATA">
+<!-- the label "PKGVERSIONDATA" is contained in the "PackageInfo.g" file -->
+]>
+
+<!-- Documentation to the IntegersEm package. -->
+
+<Book Name="IntegersEm">
+
+<TitlePage>
+  <Title>&IntegersEm;</Title>
+  <Subtitle>A &GAP; package for visualizing sets of integers</Subtitle>
+  <Version>Version &VERSION;</Version>
+  <Date>&RELEASEDATE;</Date>
+ 
+  <Author>Manuel Delgado 
+    <Email>mdelgado@fc.up.pt</Email>
+    <Homepage>http://cmup.fc.up.pt/cmup/mdelgado/</Homepage>
+  </Author>
+  <Copyright>
+    <Index>License</Index>
+      &copyright; 2012 M. Delgado<P/>
+      <Alt Only="LaTeX">\noindent</Alt> &IntegersEm; package is free software; 
+      you can redistribute it and/or modify it under the terms of the 
+        <URL Text="GNU General Public License">http://www.fsf.org/licenses/gpl.html</URL> 
+      as published by the Free Software Foundation; either version 2 of the
+      License, or (at your option) any later version. 
+  </Copyright>
+  <Colophon>
+    This manual describes the &GAP; 4.5 package &IntegersEm; version
+  &VERSION; for visualising sets of integers. 
+  </Colophon>
+  <Acknowledgements>
+The author was partially funded by the European Regional Development Fund
+through the program COMPETE and by the Portuguese Government through the FCT
+- Fundação para a Ciência e a Tecnologia under the project
+PEst-C/MAT/UI0144/2011. 
+<P/>
+He benefited also of the sabbatical grant SFRH/BSAB/1156/2011.
+<P/>
+Furthermore, I want to thank my colleagues of the Mathematics Department of
+the Faculty of Sciences of the University of Porto for the opportunity of
+taking a sabbatical year during the 2011/2012 school year.
+<P/>
+For one reason or another that ranges from suggestions to encouragement, I
+want express my gratitude to Pedro A. García Sánchez, David Llena and James
+Mitchel.
+  </Acknowledgements>
+</TitlePage>
+
+<TableOfContents/>
+
+<Body>
+  <Chapter Label="intro">
+  <Heading>The &IntegersEm; package</Heading>
+  <Index>&IntegersEm; - Overview</Index>	
+  <Section><Heading>Overview and Introduction</Heading>
+  The &IntegersEm; package has two main goals:
+    <List>
+    
+      <Item>Provide an immediate visualization of subsets of sets of integers</Item>
+    
+      <Item>Produce Tikz code to be included in a LaTeX file.</Item>
+
+    </List>
+
+  The drawing is done by producing some text representation (dot or tikz code) which is then processed by external tools.<P />
+<!--  <#Include SYSTEM "intro.xml"> -->
+This package grew up from the author's will to have a pictorial view of some sets of integers. Effort has then been made to serve a slightly more general purpose.
+For instance, if the user wants to have a pictorial idea of how many primes there are between 800 and 1000, or show it to his students and, perhaps, which among these primes are twin primes, he will probably be happy by producing a picture like the following
+     <P />
+
+    <Alt Only="LaTeX">
+      \begin{center}
+        \input{images/primesandtwins.tex}
+      \end{center}
+    </Alt>
+    <Alt Only="HTML">
+      &#60;br&#62;&#60;center&#62;&#60;img src=&#34;images/primesandtwins.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
+    </Alt>
+    <P />
+
+It has clearly too much information, given through the different colors. The twin primes are in red-green, while the other primes are in red. 
+    <P />
+This package contains relatively few lines of code. The heavy part is the manual, where many examples are presented.
+<P />
+The design of the code greatly benefits from my long experience on producing visualisation tools for &GAP; objects. The package <Package>sgpviz</Package> <Cite Key="DelgadoMorais:sgpviz"></Cite> is the visible part. More recently, I got involved in a more general project, the <Package>viz</Package> package <Cite Key="DelgadoEgri-NagyMitchellPfeiffer2012-Viz"></Cite>.
+The experience gained there, especially through long and fruitfull discussions with J. Mitchell, has greatly influenced. This package will eventually be part of that project. For the moment, it is independent, but its results may be better appreciated if <Package>viz</Package> is installed.
+<P />
+The package produces tikz od dot code that the user may then use at his wish. In particular, can use it in publications.
+But prior to obtaining results that lead to a publication, the user may benefit of viewing thousands of images. There is a function in <Package>viz</Package> that is intended to make this task easy.
+It is intended to be almost platform independent. It bennefits from the &GAP; stuff on creating a temporary directory where the computations occur. The cleaning task is also left to &GAP;, wich leaves the user free of the need of collecting the garbage.
+
+<C>graphviz</C> (see <URL>http://www.graphviz.org/</URL>), or <C>LaTeX</C> together with some packages, in particular, the <C>Tikz</C> package, must be installed.
+
+<P />
+This package consists basically of a function with many options associated. The purpose of the manual is to illustrate the use of the options.
+
+  </Section>
+<!-- ######################################## -->
+  <Section Label="install">
+    <Heading>Installing &IntegersEm;</Heading>
+    In this section we give a brief description of how to start using  
+    &IntegersEm;. If you have any problems getting
+    &IntegersEm; working, then you could try emailling me at
+    <Email>mdelgado@fc.up.pt</Email>. <P/>
+
+<!--  <Subsection Label="summary">
+    <Heading>Summary</Heading>
+The following is a summary of the steps 
+    that should lead to a successful
+    installation of &IntegersEm;:
+   <List>
+      <Item> download the package archive <C>integersem.tar.gz</C> from
+      <Alt    Only="LaTeX">\vspace{\baselineskip}</Alt><P/>
+          <Alt Only="LaTeX">\noindent\vspace{\baselineskip}</Alt><URL>http://cmup.fc.up.pt/cmup/mdelgado/integersem/
+      </URL></Item>
+    
+      <Item> unzip and untar the file, this should create a directory called
+      <C>integersem</C>.</Item>
+    
+      <Item> 
+      locate the <C>pkg</C> directory of your &GAP; directory, which contains
+      several other directories such as <C>lib</C>, <C>doc</C> and so on. Move 
+      the directory <C>integersem</C> into the <C>pkg</C> directory.
+      </Item>
+    
+      <Item> start &GAP; in the usual way.</Item>
+    
+      <Item> type <C>LoadPackage("integersem");</C></Item>
+      
+      <Item> compile the documentation by typing <C>IntegersEmMakeDoc()</C></Item>
+
+    </List>
+  </Subsection>-->
+
+    It is assumed that you have a working copy of &GAP; with version number 
+    4.5 or higher. The most up-to-date version of &GAP; and instructions on
+    how to install it can be obtained from the main &GAP; webpage
+   <Alt    Only="LaTeX">\vspace{\baselineskip}</Alt><P/>
+       <Alt Only="LaTeX">\noindent\vspace{\baselineskip}</Alt>
+    <URL>http://www.gap-system.org</URL><P/>
+
+    <Alt Only="LaTeX">\noindent</Alt> 
+If the &IntegersEm; package was obtained as a part of the &GAP; distribution
+from the <Q>Download</Q> section of the &GAP; website, you may proceed
+to Section <Ref Sect="loading"/>.
+Alternatively, the &IntegersEm; package may be installed using a separate archive,
+for example, for an update or an installation in a non-default location 
+(see <Ref Sect="GAP Root Directories" BookName="ref"/>).
+<P/>
+
+Below we describe the installation procedure for the <File>.tar.gz</File> 
+archive format, which can be obtained from
+      <Alt    Only="LaTeX">\vspace{\baselineskip}</Alt><P/>
+          <Alt Only="LaTeX">\noindent\vspace{\baselineskip}</Alt><URL>http://cmup.fc.up.pt/cmup/mdelgado/integersem/
+      </URL>. 
+Installation using other archive formats is performed in a 
+similar way.
+<P/>
+
+To install the &IntegersEm; package, unpack the archive file, which  should
+have a name of form <C>integersem-<A>XXX</A>.tar.gz</C> for some version number 
+<A>XXX</A>, by typing
+<P/>
+&nbsp;&nbsp;<C>gzip -dc integersem-<A>XXX</A>.tar.gz | tar xpv</C>
+<P/>
+
+It may be unpacked in one of the following locations:
+<List>
+<Item>
+in the <File>pkg</File> directory of your &GAP;&nbsp;4 installation;
+</Item>
+<Item>
+or in a directory named <File>.gap/pkg</File> in your home directory
+(to be added to the &GAP; root directory unless &GAP; is started with
+<C>-r</C> option);
+</Item> 
+<Item>
+or in a directory named <File>pkg</File> in another directory of your 
+choice (e.g.&nbsp;in the directory <File>mygap</File> in your home 
+directory).
+</Item>
+</List>
+
+In the latter case one one must start &GAP; with the <C>-l</C> option,
+e.g.&nbsp;if your private <F>pkg</F> directory is a subdirectory of 
+<F>mygap</F> in your home directory you might type:
+<P/>
+&nbsp;&nbsp;<C>gap -l ";<A>myhomedir</A>/mygap"</C>
+<P/>
+where <A>myhomedir</A> is the  path  to  your  home  directory,  which may be replaced  by  a  tilde (the  empty  path  before  the
+semicolon is  filled  in  by  the  default  path  of  the  &GAP;&nbsp;4  home
+directory).
+</Section>
+
+<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
+
+
+<Section Label="loading">
+<Heading>Loading the IntegersEm Package</Heading>
+
+To use the &IntegersEm; Package you have to request it explicitly. This  is
+done by calling <Ref Func="LoadPackage" BookName="ref"/>:
+<P/>
+<Example><![CDATA[
+gap> LoadPackage("integersem");
+----------------------------------------------------------------
+Loading  integersem 0.0.1 (Highlighting sets of integers)
+by Manuel Delgado (http://www.fc.up.pt/cmup/mdelgado).
+Homepage: http://www.fc.up.pt/cmup/mdelgado/integersem
+----------------------------------------------------------------
+true
+]]></Example>
+<P/>
+
+If &GAP; cannot find a working binary, the call  to  <C>LoadPackage</C>  will
+still succeed but a warning is issued informing that  the  <C>HelloWorld()</C>
+function will be unavailable.
+<P/>
+If you want to load the &IntegersEm; package by default, you  can  put  the
+<C>LoadPackage</C> command  into  your  <F>gaprc</F>  file  
+(see  Section&nbsp;<Ref Sect="The gap.ini and gaprc files" BookName="ref"/>).
+
+</Section>
+  <Section Label="doc"><Heading>Compiling the documentation</Heading>
+
+    To compile the documentation see <Ref Func="IntegersEmMakeDoc"/>. If you want
+    to use the help system it is essential that you compile the documentation. 
+
+  <ManSection><Heading>Compiling the documentation</Heading>
+  <Func Name="IntegersEmMakeDoc" Arg=""/>
+  <Description>
+  Compiles the documentation. 
+  </Description>
+ </ManSection>
+  </Section>
+</Chapter>
+<Chapter Label="functions">
+  <Heading>The <Package>IntegersEm</Package> package functions</Heading>
+ <Section><Heading>Functions</Heading>
+ <#Include Label="TikzArrayOfIntegers">
+  </Section>
+</Chapter>
+
+<Chapter Label="examples">
+  <Heading>Examples of use of the  <Package>IntegersEm</Package> package</Heading>
+  <Index><Package>IntegersEm</Package> - Examples</Index>	
+  <Section><Heading>Examples</Heading>
+<#Include Label="twins">
+
+  </Section>
+</Chapter>
+<Chapter Label="options">
+  <Heading>The <Package>IntegersEm</Package> package options</Heading>
+ <Section><Heading>Configuration Options</Heading>
+ The configurable options can be set in <C>config</C> file in the main directory of the package.
+
+<List>
+<Item> ...</Item>
+</List>
+
+  </Section>
+</Chapter>
+</Body>
+
+<Bibliography Databases="IntegersEm" />
+<TheIndex/>
+
+</Book>
+  
+<!-- ==================================================================== -->

File doc/draw.xml

+
+ <#GAPDoc Label="TikzArrayOfIntegers">
+  <ManSection><Heading>Tikz code for arrays</Heading>
+  <Func Name="TikzArrayOfIntegers" Arg="arg"/>
+  <Description>
+This function aims to produce tikz code for displaying arrays of integers.
+<P/>
+Input: the arguments (at most 3) are: 
+a range or a table of integers,
+an integer (indicating the length of the floors; it is only needed when a range is given as first argument.
+a record of options. For details on these see the default options...
+  </Description>
+ </ManSection>
+<Example><![CDATA[
+gap> rg := [81..99];;
+gap> len := 10;;
+gap> arr := [Primes,Filtered(rg,u->(u mod 2)=0),Filtered(rg,u->(u mod 3)=0)];;
+gap> tkz := TikzArrayOfIntegers(rg,len,rec(highlights:=arr));;
+]]></Example>
+tkz is a string that can be used at the user wish. In paricular, to the standard output using the command <Ref Func="Print" BookName="ref"/>.
+<Example><![CDATA[
+gap> Print(tkz);
+%tikz
+\begin{tikzpicture}
+\matrix[row sep=2pt,column sep=2pt]
+{\node[minimum width=20pt,draw]{91};&
+\node[minimum width=20pt,draw,fill=green]{92};&
+\node[minimum width=20pt,draw,fill=blue]{93};&
+\node[minimum width=20pt,draw,fill=green]{94};&
+\node[minimum width=20pt,draw]{95};&
+\node[minimum width=20pt,draw,left color=green,right color=blue]{96};&
+## several more lines ##
+\node[minimum width=20pt,draw,fill=green]{88};&
+\node[minimum width=20pt,draw,fill=red]{89};&
+\node[minimum width=20pt,draw,left color=green,right color=blue]{90};\\
+};
+ \end{tikzpicture}
+gap> 
+]]></Example>
+Or it can be printed into a file by using the command 
+<Ref Func="PrintTo" BookName="ref"/>. Then it can be processed using &LaTeX; once you put in the preamble something like 
+
+<Example><![CDATA[
+\usepackage[x11names, rgb]{xcolor}
+\usepackage{pgf}
+\usepackage{tikz}
+\usepgfmodule{plot}
+\usepgflibrary{plothandlers}
+\usetikzlibrary{shapes.geometric}
+\usetikzlibrary{shadings}
+]]></Example>
+The picture obtained is the following
+    <Alt Only="LaTeX">
+      \begin{center}
+        \input{81to99.tex}
+      \end{center}
+    </Alt>
+    <Alt Only="HTML">
+      &#60;br&#62;&#60;center&#62;&#60;img src=&#34;81to99.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
+    </Alt>
+    <P />
+
+Alternatively, if you have the <Package>viz</Package> package installed, you may do the following:
+<Example><![CDATA[
+Splash(tkz);
+]]></Example>
+A picture is poped up. To know which is the temporary directory used you should set the info level <C>InfoViz</C> to <M>1</M> or more. The following example illustrates the use of some options of the <Ref Func="splash" BookName="viz"/>  of the <Package>viz</Package> package. Setting the option <C>papersize</C> to "a0paper" may be convenient for the visualisation of large images. The pdf viewer can also be changed.   
+
+<Example><![CDATA[
+gap> SetInfoLevel(InfoViz,1);
+gap> Splash(tkz,rec(latexpoints:="10pt",papersize:="a0paper",viewer:="okular")); 
+#I  The temporary directory used is: /tmp/tmJcpphI/
+]]></Example>
+
+The temporary directory /tmp/tmJcpphI/ contains the files vizpicture1.tex and 
+vizpicture.tex. The file vizpicture1.tex contains the tikz code (and can be copied to any other place) and the file vizpicture.tex is the &LaTeX; document to be processed. Other files, namely the <C>vizpicture.pdf</C> are created by the <C>pdflatex</C> command that is called by the  <Ref Func="splash" BookName="viz"/> function.  
+
+<#/GAPDoc>

File doc/examples.xml

+<#GAPDoc Label="twins">
+The following example produces a picture containing the odd integers from <M>801</M> to <M>999</M>. Each line (except the highest) contains <M>15</M> cells.
+<Example><![CDATA[
+gap> rg := Filtered([801..999],u->(u mod 2)<>0);;
+gap> flen := 15;;
+gap> twins := Filtered(Primes, p -> p + 2 in Primes);; 
+gap> arr := [Primes,Union(aux,aux+2),Filtered(rg,u->(u mod 3)=0)];;
+gap> TikzArrayOfIntegers(rg,flen,rec(allow_adjust_cell_width := "5",
+> highlights:=arr));;
+gap> Splash(last);
+]]></Example> 
+The picture obtained highlights the primes (red), the twin primes (green) and the multiples of <M>3</M>. It is as follows:
+    <Alt Only="LaTeX">
+      \begin{center}
+        \input{primesandtwinsamongodd.tex}
+      \end{center}
+    </Alt>
+    <Alt Only="HTML">
+      &#60;br&#62;&#60;center&#62;&#60;img src=&#34;primesandtwinsamongodd.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
+    </Alt>
+    <P />
+<#/GAPDoc>

File doc/images/primesandtwins.jpg

Added
New image

File doc/images/primesandtwins.tex

+%tikz
+\begin{tikzpicture}
+\matrix[row sep=2pt,column sep=2pt]
+{\node[minimum width=15pt,draw,left color=blue,right color=-red]{996};&
+\node[minimum width=15pt,draw,fill=red]{997};&
+\node[minimum width=15pt,draw,fill=blue]{998};&
+\node[minimum width=15pt,draw,fill=-red]{999};\\
+\node[minimum width=15pt,draw,fill=-red]{981};&
+\node[minimum width=15pt,draw,fill=blue]{982};&
+\node[minimum width=15pt,draw,fill=red]{983};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{984};&
+\node[minimum width=15pt,draw,fill=-green]{985};&
+\node[minimum width=15pt,draw,left color=blue,middle color=red!50,right color=-red!50]{986};&
+\node[minimum width=15pt,draw,left color=-red,right color=-blue]{987};&
+\node[minimum width=15pt,draw,left color=blue,middle color=black!30,right color=green!50]{988};&
+\node[minimum width=15pt,draw,fill=blue!50]{989};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green,color=black!80]{990};&
+\node[minimum width=15pt,draw,fill=red]{991};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green!50]{992};&
+\node[minimum width=15pt,draw,fill=-red]{993};&
+\node[minimum width=15pt,draw,left color=blue,right color=-blue]{994};&
+\node[minimum width=15pt,draw,fill=-green]{995};\\
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-blue,color=blue!50]{966};&
+\node[minimum width=15pt,draw,fill=red]{967};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!80]{968};&
+\node[minimum width=15pt,draw,left color=-red,middle color=red!50,right color=green!50]{969};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{970};&
+\node[minimum width=15pt,draw,fill=red]{971};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{972};&
+\node[minimum width=15pt,draw,fill=-blue]{973};&
+\node[minimum width=15pt,draw,fill=blue]{974};&
+\node[minimum width=15pt,draw,left color=-red,middle color=-green,right color=black!30]{975};&
+\node[minimum width=15pt,draw,fill=blue]{976};&
+\node[minimum width=15pt,draw,fill=red]{977};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{978};&
+\node[minimum width=15pt,draw,fill=black!80]{979};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=-blue]{980};\\
+\node[minimum width=15pt,draw,fill=-red]{951};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-blue,right color=red!50]{952};&
+\node[minimum width=15pt,draw,fill=red]{953};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{954};&
+\node[minimum width=15pt,draw,fill=-green]{955};&
+\node[minimum width=15pt,draw,fill=blue]{956};&
+\node[minimum width=15pt,draw,left color=-red,middle color=black!80,right color=-red!50]{957};&
+\node[minimum width=15pt,draw,fill=blue]{958};&
+\node[minimum width=15pt,draw,fill=-blue]{959};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green]{960};&
+\node[minimum width=15pt,draw,fill=-green!50]{961};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!30]{962};&
+\node[minimum width=15pt,draw,fill=-red]{963};&
+\node[minimum width=15pt,draw,fill=blue]{964};&
+\node[minimum width=15pt,draw,fill=-green]{965};\\
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=black!30]{936};&
+\node[minimum width=15pt,draw,fill=red]{937};&
+\node[minimum width=15pt,draw,left color=blue,right color=-blue]{938};&
+\node[minimum width=15pt,draw,fill=-red]{939};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{940};&
+\node[minimum width=15pt,draw,fill=red]{941};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{942};&
+\node[minimum width=15pt,draw,fill=blue!50]{943};&
+\node[minimum width=15pt,draw,fill=blue]{944};&
+\node[minimum width=15pt,draw,left color=-red,middle color=-green,right color=-blue]{945};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!80]{946};&
+\node[minimum width=15pt,draw,fill=red]{947};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{948};&
+\node[minimum width=15pt,draw,fill=black!30]{949};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=green!50]{950};\\
+\node[minimum width=15pt,draw,fill=-red]{921};&
+\node[minimum width=15pt,draw,fill=blue]{922};&
+\node[minimum width=15pt,draw,fill=black!30]{923};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-blue,color=black!80]{924};&
+\node[minimum width=15pt,draw,fill=-green]{925};&
+\node[minimum width=15pt,draw,fill=blue]{926};&
+\node[minimum width=15pt,draw,fill=-red]{927};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red!50]{928};&
+\node[minimum width=15pt,draw,fill=red]{929};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green,color=-green!50]{930};&
+\node[minimum width=15pt,draw,left color=-blue,right color=green!50]{931};&
+\node[minimum width=15pt,draw,fill=blue]{932};&
+\node[minimum width=15pt,draw,fill=-red]{933};&
+\node[minimum width=15pt,draw,fill=blue]{934};&
+\node[minimum width=15pt,draw,left color=-green,middle color=black!80,right color=red!50]{935};\\
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{906};&
+\node[minimum width=15pt,draw,fill=red]{907};&
+\node[minimum width=15pt,draw,fill=blue]{908};&
+\node[minimum width=15pt,draw,fill=-red]{909};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=-blue,color=black!30]{910};&
+\node[minimum width=15pt,draw,fill=red]{911};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=green!50]{912};&
+\node[minimum width=15pt,draw,fill=black!80]{913};&
+\node[minimum width=15pt,draw,fill=blue]{914};&
+\node[minimum width=15pt,draw,left color=-red,right color=-green]{915};&
+\node[minimum width=15pt,draw,fill=blue]{916};&
+\node[minimum width=15pt,draw,fill=-blue]{917};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=red!50]{918};&
+\node[minimum width=15pt,draw,fill=red]{919};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=blue!50]{920};\\
+\node[minimum width=15pt,draw,left color=-red,right color=black!80]{891};&
+\node[minimum width=15pt,draw,fill=blue]{892};&
+\node[minimum width=15pt,draw,fill=green!50]{893};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{894};&
+\node[minimum width=15pt,draw,fill=-green]{895};&
+\node[minimum width=15pt,draw,left color=blue,right color=-blue]{896};&
+\node[minimum width=15pt,draw,left color=-red,middle color=black!30,right color=blue!50]{897};&
+\node[minimum width=15pt,draw,fill=blue]{898};&
+\node[minimum width=15pt,draw,left color=-red!50,right color=-green!50]{899};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green]{900};&
+\node[minimum width=15pt,draw,fill=red!50]{901};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!80]{902};&
+\node[minimum width=15pt,draw,left color=-red,right color=-blue]{903};&
+\node[minimum width=15pt,draw,fill=blue]{904};&
+\node[minimum width=15pt,draw,fill=-green]{905};\\
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{876};&
+\node[minimum width=15pt,draw,fill=red]{877};&
+\node[minimum width=15pt,draw,fill=blue]{878};&
+\node[minimum width=15pt,draw,fill=-red]{879};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=black!80]{880};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{881};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-blue]{882};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{883};&
+\node[minimum width=15pt,draw,left color=blue,middle color=black!30,right color=red!50]{884};&
+\node[minimum width=15pt,draw,left color=-red,right color=-green]{885};&
+\node[minimum width=15pt,draw,fill=blue]{886};&
+\node[minimum width=15pt,draw,fill=red]{887};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{888};&
+\node[minimum width=15pt,draw,fill=-blue]{889};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{890};\\
+\node[minimum width=15pt,draw,left color=-red,right color=-blue]{861};&
+\node[minimum width=15pt,draw,fill=blue]{862};&
+\node[minimum width=15pt,draw,fill=red]{863};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{864};&
+\node[minimum width=15pt,draw,fill=-green]{865};&
+\node[minimum width=15pt,draw,fill=blue]{866};&
+\node[minimum width=15pt,draw,left color=-red,right color=red!50]{867};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-blue,right color=-green!50]{868};&
+\node[minimum width=15pt,draw,fill=black!80]{869};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green,color=-red!50]{870};&
+\node[minimum width=15pt,draw,fill=black!30]{871};&
+\node[minimum width=15pt,draw,fill=blue]{872};&
+\node[minimum width=15pt,draw,fill=-red]{873};&
+\node[minimum width=15pt,draw,left color=blue,middle color=green!50,right color=blue!50]{874};&
+\node[minimum width=15pt,draw,left color=-green,right color=-blue]{875};\\
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{846};&
+\node[minimum width=15pt,draw,left color=-blue,right color=black!80]{847};&
+\node[minimum width=15pt,draw,fill=blue]{848};&
+\node[minimum width=15pt,draw,fill=-red]{849};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-green,right color=red!50]{850};&
+\node[minimum width=15pt,draw,fill=blue!50]{851};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{852};&
+\node[minimum width=15pt,draw,fill=red]{853};&
+\node[minimum width=15pt,draw,left color=blue,right color=-blue]{854};&
+\node[minimum width=15pt,draw,left color=-red,middle color=-green,right color=green!50]{855};&
+\node[minimum width=15pt,draw,fill=blue]{856};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{857};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=black!80,color=black!30]{858};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{859};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{860};\\
+\node[minimum width=15pt,draw,fill=-red]{831};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!30]{832};&
+\node[minimum width=15pt,draw,left color=-blue,right color=red!50]{833};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{834};&
+\node[minimum width=15pt,draw,fill=-green]{835};&
+\node[minimum width=15pt,draw,left color=blue,middle color=black!80,right color=green!50]{836};&
+\node[minimum width=15pt,draw,left color=-red,right color=-green!50]{837};&
+\node[minimum width=15pt,draw,fill=blue]{838};&
+\node[minimum width=15pt,draw,fill=red]{839};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green,color=-blue]{840};&
+\node[minimum width=15pt,draw,fill=-red!50]{841};&
+\node[minimum width=15pt,draw,fill=blue]{842};&
+\node[minimum width=15pt,draw,fill=-red]{843};&
+\node[minimum width=15pt,draw,fill=blue]{844};&
+\node[minimum width=15pt,draw,left color=-green,right color=black!30]{845};\\
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=red!50]{816};&
+\node[minimum width=15pt,draw,fill=green!50]{817};&
+\node[minimum width=15pt,draw,fill=blue]{818};&
+\node[minimum width=15pt,draw,left color=-red,middle color=-blue,right color=black!30]{819};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{820};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{821};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{822};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{823};&
+\node[minimum width=15pt,draw,fill=blue]{824};&
+\node[minimum width=15pt,draw,left color=-red,middle color=-green,right color=black!80]{825};&
+\node[minimum width=15pt,draw,left color=blue,right color=-blue]{826};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{827};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=blue!50]{828};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{829};&
+\node[minimum width=15pt,draw,left color=blue,right color=-green]{830};\\
+\node[minimum width=15pt,draw,fill=-red]{801};&
+\node[minimum width=15pt,draw,fill=blue]{802};&
+\node[minimum width=15pt,draw,fill=black!80]{803};&
+\node[minimum width=15pt,draw,left color=blue,right color=-red]{804};&
+\node[minimum width=15pt,draw,left color=-green,middle color=-blue,right color=blue!50]{805};&
+\node[minimum width=15pt,draw,left color=blue,middle color=black!30,right color=-green!50]{806};&
+\node[minimum width=15pt,draw,fill=-red]{807};&
+\node[minimum width=15pt,draw,fill=blue]{808};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{809};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-red,right color=-green]{810};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{811};&
+\node[minimum width=15pt,draw,left color=blue,middle color=-blue,right color=-red!50]{812};&
+\node[minimum width=15pt,draw,fill=-red]{813};&
+\node[minimum width=15pt,draw,left color=blue,right color=black!80]{814};&
+\node[minimum width=15pt,draw,fill=-green]{815};\\
+};
+ \end{tikzpicture}

File doc/images/primesandtwinsamongodd.jpg

Added
New image

File doc/images/primesandtwinsamongodd.tex

+%tikz
+\begin{tikzpicture}
+\matrix[row sep=2pt,column sep=2pt]
+{\node[minimum width=15pt,draw,fill=-red]{981};&
+\node[minimum width=15pt,draw,fill=red]{983};&
+\node[minimum width=15pt,draw]{985};&
+\node[minimum width=15pt,draw,fill=-red]{987};&
+\node[minimum width=15pt,draw]{989};&
+\node[minimum width=15pt,draw,fill=red]{991};&
+\node[minimum width=15pt,draw,fill=-red]{993};&
+\node[minimum width=15pt,draw]{995};&
+\node[minimum width=15pt,draw,fill=red]{997};&
+\node[minimum width=15pt,draw,fill=-red]{999};\\
+\node[minimum width=15pt,draw,fill=-red]{951};&
+\node[minimum width=15pt,draw,fill=red]{953};&
+\node[minimum width=15pt,draw]{955};&
+\node[minimum width=15pt,draw,fill=-red]{957};&
+\node[minimum width=15pt,draw]{959};&
+\node[minimum width=15pt,draw]{961};&
+\node[minimum width=15pt,draw,fill=-red]{963};&
+\node[minimum width=15pt,draw]{965};&
+\node[minimum width=15pt,draw,fill=red]{967};&
+\node[minimum width=15pt,draw,fill=-red]{969};&
+\node[minimum width=15pt,draw,fill=red]{971};&
+\node[minimum width=15pt,draw]{973};&
+\node[minimum width=15pt,draw,fill=-red]{975};&
+\node[minimum width=15pt,draw,fill=red]{977};&
+\node[minimum width=15pt,draw]{979};\\
+\node[minimum width=15pt,draw,fill=-red]{921};&
+\node[minimum width=15pt,draw]{923};&
+\node[minimum width=15pt,draw]{925};&
+\node[minimum width=15pt,draw,fill=-red]{927};&
+\node[minimum width=15pt,draw,fill=red]{929};&
+\node[minimum width=15pt,draw]{931};&
+\node[minimum width=15pt,draw,fill=-red]{933};&
+\node[minimum width=15pt,draw]{935};&
+\node[minimum width=15pt,draw,fill=red]{937};&
+\node[minimum width=15pt,draw,fill=-red]{939};&
+\node[minimum width=15pt,draw,fill=red]{941};&
+\node[minimum width=15pt,draw]{943};&
+\node[minimum width=15pt,draw,fill=-red]{945};&
+\node[minimum width=15pt,draw,fill=red]{947};&
+\node[minimum width=15pt,draw]{949};\\
+\node[minimum width=15pt,draw,fill=-red]{891};&
+\node[minimum width=15pt,draw]{893};&
+\node[minimum width=15pt,draw]{895};&
+\node[minimum width=15pt,draw,fill=-red]{897};&
+\node[minimum width=15pt,draw]{899};&
+\node[minimum width=15pt,draw]{901};&
+\node[minimum width=15pt,draw,fill=-red]{903};&
+\node[minimum width=15pt,draw]{905};&
+\node[minimum width=15pt,draw,fill=red]{907};&
+\node[minimum width=15pt,draw,fill=-red]{909};&
+\node[minimum width=15pt,draw,fill=red]{911};&
+\node[minimum width=15pt,draw]{913};&
+\node[minimum width=15pt,draw,fill=-red]{915};&
+\node[minimum width=15pt,draw]{917};&
+\node[minimum width=15pt,draw,fill=red]{919};\\
+\node[minimum width=15pt,draw,fill=-red]{861};&
+\node[minimum width=15pt,draw,fill=red]{863};&
+\node[minimum width=15pt,draw]{865};&
+\node[minimum width=15pt,draw,fill=-red]{867};&
+\node[minimum width=15pt,draw]{869};&
+\node[minimum width=15pt,draw]{871};&
+\node[minimum width=15pt,draw,fill=-red]{873};&
+\node[minimum width=15pt,draw]{875};&
+\node[minimum width=15pt,draw,fill=red]{877};&
+\node[minimum width=15pt,draw,fill=-red]{879};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{881};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{883};&
+\node[minimum width=15pt,draw,fill=-red]{885};&
+\node[minimum width=15pt,draw,fill=red]{887};&
+\node[minimum width=15pt,draw]{889};\\
+\node[minimum width=15pt,draw,fill=-red]{831};&
+\node[minimum width=15pt,draw]{833};&
+\node[minimum width=15pt,draw]{835};&
+\node[minimum width=15pt,draw,fill=-red]{837};&
+\node[minimum width=15pt,draw,fill=red]{839};&
+\node[minimum width=15pt,draw]{841};&
+\node[minimum width=15pt,draw,fill=-red]{843};&
+\node[minimum width=15pt,draw]{845};&
+\node[minimum width=15pt,draw]{847};&
+\node[minimum width=15pt,draw,fill=-red]{849};&
+\node[minimum width=15pt,draw]{851};&
+\node[minimum width=15pt,draw,fill=red]{853};&
+\node[minimum width=15pt,draw,fill=-red]{855};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{857};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{859};\\
+\node[minimum width=15pt,draw,fill=-red]{801};&
+\node[minimum width=15pt,draw]{803};&
+\node[minimum width=15pt,draw]{805};&
+\node[minimum width=15pt,draw,fill=-red]{807};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{809};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{811};&
+\node[minimum width=15pt,draw,fill=-red]{813};&
+\node[minimum width=15pt,draw]{815};&
+\node[minimum width=15pt,draw]{817};&
+\node[minimum width=15pt,draw,fill=-red]{819};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{821};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{823};&
+\node[minimum width=15pt,draw,fill=-red]{825};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{827};&
+\node[minimum width=15pt,draw,left color=red,right color=green]{829};\\
+};
+ \end{tikzpicture}

File doc/intro.xml

+<?xml version="1.0" encoding="UTF-8"?>
+This package grew up from the author's will to have a pictorial view of some sets of integers. Effort has then been made to serve a slightly more general purpose.
+For instance, if the user wants to have a pictorial idea of how many primes there are between 800 and 1000, or show it to his students and, perhaps, which among these primes are twin primes, he will probably be happy by producing a picture like the following
+ 
+    <Alt Only="LaTeX">
+      \begin{center}
+        \input{primesandtwins.tex}
+      \end{center}
+    </Alt>
+    <Alt Only="HTML">
+      &#60;br&#62;&#60;center&#62;&#60;img src=&#34;primesandtwins.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
+    </Alt>
+    <P />
+
+It has clearly too much information, given through the different colors. The twin primes are in red-green, while the other primes are in red. 

File doc/options.xml

+<Chapter Label="options">
+  <Heading>The <Package>IntegersViz</Package> package options</Heading>
+ <Section><Heading>Configuration Options</Heading>
+ The configurable options can be set in <C>config</C> file in the main directory of the package.
+
+  </Section>
+</Chapter>

File gap/ie_colors.gd

+#The idea in what concerns the colors is the following: the reader is free to
+#choose his colors (the latex xcolor package is used), but we try to make users
+#life reasonably easy. He is allowed to choose tones. The default colors are not
+#many, although (from our experience) sufficient for most examples. The reason
+#for being few is that we do not want to get confused with the
+#colors. Furthermore, when only a few of the available colors are used the
+#choosed colors are as different as possible. 
+#  For instance: ... suppose the 
+#  distinct colors are choosed 
+
+#########
+# Lists of colors (with the same tone)
+#all the lists must have length 5. Othewise, only the first 5 colors are used.
+BindGlobal("IE_TonesLength",5);
+
+## red
+BindGlobal("IEmColorsRedTones", 
+  [
+   "red","red!50","red!20","red!80!green!50","red!80!blue!60"
+   ]); 
+##  cyan (complement of red)
+BindGlobal("IEmColorsCompRedTones", 
+  [
+   "-red","-red!50","-red!20","-red!80!green!50","-red!80!blue!60"
+   ]); 
+## green 
+BindGlobal("IEmColorsGreenTones", 
+  [
+   "green","green!50","green!20","green!80!red!50","green!80!blue!60"
+   ]); 
+## magenta (complement of green)
+BindGlobal("IEmColorsCompGreenTones", 
+  [
+   "-green","-green!50","-green!20","-green!80!red!50","-green!80!blue!60"
+   ]); 
+## blue
+BindGlobal("IEmColorsBlueTones", 
+  [
+   "blue","blue!50","blue!20","blue!80!red!50","blue!80!green!60"
+   ]); 
+## yellow (complement of blue)
+BindGlobal("IEmColorsCompBlueTones", 
+  [
+   "-blue","-blue!50","-blue!20","-blue!80!red!50","-blue!80!green!60"
+   ]); 
+## dark gray
+BindGlobal("IEmColorsDGrayTones", 
+  [
+   "black!80","black!70","black!60","black!50","black!40"
+   ]);
+## light gray
+BindGlobal("IEmColorsLGrayTones", 
+  [
+   "black!30","black!25","black!20","black!15","black!10"
+   ]);
+########
+BindGlobal("RecordOfColorsForIEm", 
+  rec(Reds := IEmColorsRedTones,
+      rEDS := IEmColorsCompRedTones,
+      Greens := IEmColorsGreenTones,
+      gREENS := IEmColorsCompGreenTones,
+      Blues := IEmColorsBlueTones,
+      bLUES := IEmColorsCompBlueTones,
+      DGrays := IEmColorsDGrayTones,
+      LGrays := IEmColorsLGrayTones
+      ));
+########
+BindGlobal("ListsOfIEmColors",
+  [RecordOfColorsForIEm.Reds,
+   RecordOfColorsForIEm.Greens,
+   RecordOfColorsForIEm.Blues,
+   RecordOfColorsForIEm.rEDS,
+   RecordOfColorsForIEm.gREENS,
+   RecordOfColorsForIEm.bLUES,
+   RecordOfColorsForIEm.DGrays,
+   RecordOfColorsForIEm.LGrays
+   ]);
+########
+BindGlobal("IEmColors",
+  Concatenation(
+  [RecordOfColorsForIEm.Reds,
+   RecordOfColorsForIEm.Greens,
+   RecordOfColorsForIEm.Blues,
+   RecordOfColorsForIEm.rEDS,
+   RecordOfColorsForIEm.gREENS,
+   RecordOfColorsForIEm.bLUES,
+   RecordOfColorsForIEm.DGrays,
+   RecordOfColorsForIEm.LGrays
+   ]));
+#########
+BindGlobal("ShuffledIEmcolors",
+        Concatenation(TransposedMat(ListsOfIEmColors)));
+
+#################################################
+DeclareGlobalFunction("PickElementsFromList");
+#################################################
+DeclareGlobalFunction("PickSublistsFromListOfLists");
+#################################################
+DeclareGlobalFunction("IEmColorsByTones");
+#################################################
+DeclareGlobalFunction("IEmColorsForOneImage");
+#################################################
+DeclareGlobalFunction("ShuffleIEmColors");

File gap/ie_colors.gi

+#input: source is a list of length s; n is the number of elements to be picked
+#the distance between the elements picked is aproximately the number of
+#remaining elements by the number of deserts.
+#the first element is always picked.
+InstallGlobalFunction(PickElementsFromList,
+function(source,n)
+  local  s, list, gaplen, idx, i;
+  
+  s := Length(source);
+  
+  if n >= s then
+    list := Concatenation(source,source);
+    while Length(list)<n do
+      list := Concatenation(list,source);
+    od;
+    return list{[1..n]};
+  fi;
+  
+  gaplen := Int((s-n)/(n-1)); #the distance from an index to the following one used
+  
+  idx := 1;
+  list := [source[idx]];
+  
+  for i in [1..n-1] do
+    idx := idx+1+gaplen;
+    Add(list,source[idx]);
+  od;
+  return list;
+end);
+########
+InstallGlobalFunction(PickSublistsFromListOfLists,
+        function(mat,list)
+  
+  return List([1..Length(mat)], ll -> PickElementsFromList(mat[ll],list[ll]));
+end);
+
+#########
+# the input is either a list of tones or are tones
+InstallGlobalFunction(IEmColorsByTones,
+        function(arg)
+  local  tons, admissible, diff, tones, colors, tone;
+  if IsString(arg[1]) then
+    tons := Filtered(arg, t->IsString(t));
+  elif IsString(arg[1][1]) then
+    tons := arg[1];
+  fi;
+  
+  admissible := ["Red","rED","Green","gREEN","Blue","bLUE","DGray","LGray"];
+  diff := Difference(tons,admissible);
+  if diff <> [] then
+    Print(" the strings ", diff, " does not correspond to lists of colors \n");
+    Print("and will be ignored.\n");
+  fi;
+  if tons = [] then
+    tones := admissible;
+  else
+    tones := tons;
+  fi;
+  colors := [];
+  
+  for tone in tones do
+    if tone = "Red" then 
+      Add(colors,RecordOfColorsForIEm.Reds);
+    fi;
+    if tone = "rED" then 
+      Add(colors,RecordOfColorsForIEm.rEDSs);
+    fi;
+    if tone = "Green" then 
+      Add(colors,RecordOfColorsForIEm.Greens);
+    fi;
+    if tone = "gREEN" then 
+      Add(colors,RecordOfColorsForIEm.gREENS);
+    fi;
+    if tone = "Blue" then 
+      Add(colors,RecordOfColorsForIEm.Blues);
+    fi;
+    if tone = "bLUE" then 
+      Add(colors,RecordOfColorsForIEm.bLUES);
+    fi;
+    if tone = "DGray" then 
+      Add(colors,RecordOfColorsForIEm.DGrays);
+    fi;
+    if tone = "LGray" then
+       Add(colors,RecordOfColorsForIEm.LGrays);
+    fi;
+  od;
+  return colors;
+  
+end);
+
+
+########
+# this function has as input a list of tones (from the list
+# ["Red","rED","Green","gREEN","Blue","bLUE","DGray","LGray"]) and a number (which is the
+# number of colors to be used) -- the tones list is optional: if it is not
+# present, all colors are used. The number is optional too: when not present,
+# the colors used are all the colors of the selected tones.
+# For each tone there is a list of *5* colors
+#
+#
+InstallGlobalFunction(IEmColorsForOneImage,
+        function(arg)
+  local  tones, admissible, diff, num_tones, mat, n, num_available_colors, 
+         num_per_tone;
+
+  tones := Filtered(arg, t->IsString(t));
+  admissible := ["Red","rED","Green","gREEN","Blue","bLUE","DGray","LGray"];
+  if tones = fail then
+    tones := admissible;
+  else
+    diff := Difference(tones,admissible);
+    if diff <> [] then
+      Print(" the strings ", diff, " does not correspond to lists of colors \n");
+      Print("and will be ignored.\n");
+      tones := Difference(tones,diff);
+    fi;
+  fi;
+  num_tones := Length(tones);
+  mat := IEmColorsByTones(tones);
+  n := First(arg, t->IsInt(t));
+  if n = fail then
+    n := num_tones*IE_TonesLength;
+  fi;
+  num_available_colors := num_tones*IE_TonesLength;
+  if num_available_colors > n then
+    if IsInt(n/num_tones) then
+      num_per_tone := List([1..num_tones],i->n/num_tones);
+    else
+      num_per_tone := List([1..num_tones],i->Int(n/num_tones)+1);
+    fi;
+  fi;
+
+  return PickSublistsFromListOfLists(mat,num_per_tone);
+end);
+
+#
+InstallGlobalFunction(ShuffleIEmColors,
+        function(mat)
+  return Concatenation(TransposedMat(mat));
+end);
+
+

File gap/ie_dot.gd

+DeclareGlobalFunction("DotArrayOfIntegers");

File gap/ie_dot.gi

+#################
+## This function aims to produce dot code for displaying arrays of integers.
+##
+## Input: the arguments (at most 4) are: 
+#a range or a table of integers,
+#an integer (indicating the length of the floors; it is only needed when a range is given as first argument.
+#an array of integers (all the elements of each of the lists in the array is highlighted with a different color; in cases of elements that appear in more than one list are highlighted the background an the number -- the colors corresponding to the first two appearences are used) 
+#a record of options. For details on these see the default options...
+InstallGlobalFunction(DotArrayOfIntegers,
+function(arg)
+  local  opt, i, array, rg, cat, flen, aux, el, node, h, utable, 
+         k, table, dotstring, floor, nd;
+  
+  opt := First(arg, a -> IsRecord(a));
+  if opt = fail then
+    opt := DotIEmDefaultOptionsForArraysOfIntegers;
+  else
+    for i in RecNames( DotIEmDefaultOptionsForArraysOfIntegers ) do
+      if not IsBound(opt.(i)) then
+         opt.(i) := DotIEmDefaultOptionsForArraysOfIntegers.(i);
+      fi;
+    od;
+  fi;
+  array := opt.highlight;
+  
+  # the integers are put in an ordered list. The length of each floor is saved.
+  rg := First(arg, a -> not(IsRecord(a) or IsInt(a)));
+  if rg = fail then
+    cat := Concatenation(array);
+    rg := [Minimum(cat)..Maximum(cat)];
+  fi;
+  if IsRange(rg) then
+    flen := First(arg, a -> IsInt(a));
+    if flen = fail then
+      flen := Length(rg);
+    fi;
+  else
+    flen := Length(rg[1]);
+    rg := Concatenation(rg);
+  fi;
+  if opt.allow_adjust_cell_width <> "false" then
+    aux := Int(opt.allow_adjust_cell_width)*(LogInt(Maximum(rg),10)+1);
+    opt.cell_width := String(aux);
+    
+  fi;
+  
+    
+  
+  # process...
+  for i in [1..Length(rg)] do
+    el := rg[i];
+    node := [el];
+    for h in [1..Length(array)] do
+      if el in array[h] then
+        Add(node,h);
+      fi;
+    od;
+    rg[i] := node;
+  od;
+  utable := [];
+  for k in [1..Int(Length(rg)/flen)] do
+    Add(utable,rg{[(k-1)*flen+1..k*flen]});
+  od;
+  if not IsInt(Length(rg)/flen) then
+    Add(utable,rg{[Int(Length(rg)/flen)*flen+1..Length(rg)]});
+  fi;
+  
+  table := Reversed(utable);
+    
+  ##################
+  dotstring := "/*dot*/ \n graph IntegersArray {\n ";
+  Append(dotstring,Concatenation("label=<<TABLE  border=\"",opt.border,"\""));
+  Append(dotstring,Concatenation(" cellborder=\"",opt.cellborder,"\""));
+  Append(dotstring,Concatenation(" cellspacing=\"",opt.cellspacing,"\""));
+  Append(dotstring,Concatenation(" bgcolor=\"",opt.bgcolor,"\">\n "));
+#  Error("..");
+  
+  for floor in table do
+    Append(dotstring,"<TR>\n");
+    for nd in floor do
+      if Length(nd) = 1 then
+        Append(dotstring,Concatenation("<TD width = \"",opt.cell_width,"\">"));
+      elif Length(nd) >= 2 then
+        Append(dotstring,Concatenation("<TD width = \"",opt.cell_width,"\""));
+        Append(dotstring,Concatenation(" bgcolor=\"",opt.colors[nd[2]],"\">"));
+      fi;
+      if Length(nd) > 2 then
+        Append(dotstring,Concatenation("<FONT POINT-SIZE = \"",opt.point_size,"\""));
+        Append(dotstring,Concatenation(" color=\"",opt.colors[nd[3]],"\""));
+        Append(dotstring,Concatenation(">",String(nd[1]),"</FONT></TD>\n"));
+      else
+        Append(dotstring,Concatenation("<FONT POINT-SIZE = \"",opt.point_size,"\""));
+        Append(dotstring,Concatenation(">",String(nd[1]),"</FONT></TD>\n"));
+      fi;
+    od; 
+    Append(dotstring,"</TR>\n");
+  od;
+  Append(dotstring,"</TABLE>>\n }");
+  return dotstring;
+  
+end);

File gap/ie_options.gd

+BindGlobal("TikzIEmDefaultOptionsForArraysOfIntegers",
+        rec(
+            colors := ShuffledIEmcolors,
+                      colsep := "2", 
+                      rowsep := "2",
+                      cell_width := "30",
+                      allow_adjust_cell_width := "10",#the number of points per digit "false" is
+                      #also a possible option 
+                      highlights := [[]],#an array of integers (all the elements of each of the
+                      #lists in the array is highlighted with a different
+                      #color; in cases of elements that appear in more than
+                      #one list a kind of gradient (made with 3 colors) is
+                      #used for the background; the number may be printed with
+                      #a fourth color and a fifth color may be used in the
+                      #border. 
+                      ));
+
+BindGlobal("DotIEmDefaultOptionsForArraysOfIntegers",
+        rec(
+            colors := ColorsForViz,
+                      border := "1",
+                      cellborder := "1",
+                      cellspacing:="2",
+                      cellpadding:="2",
+                      bgcolor:="gray",
+                      point_size := "12",
+                      cell_width := "30",
+                      allow_adjust_cell_width := "10",#the number of points per
+                      #digit "false" is also a possible option 
+                      highlights := [[]],#an array of
+                      #integers (all the elements of each of the lists in the array
+                      #is highlighted with a different color; in cases of elements
+                      #that appear in more than one list are highlighted the
+                      #background an the number -- the colors corresponding to the
+                      #first two appearences are used)  
+                      ));
+
+

File gap/ie_options.gi

+                 
+TikzIEmDefaultOptionsForArraysOfIntegers := 
+  rec(
+      colors := IEmColorsForOneImage(),
+      colsep := "1", 
+      rowsep := "1",
+      point_size := "12",
+      cell_width := "30",
+      allow_adjust_cell_width := "10",#the number of points per digit "false" is also a possible option
+      highlights := [[]],#an array of integers (all the elements of each of the lists in the array is highlighted with a different color; in cases of elements that appear in more than one list a kind of gradient (made with 3 colors) is used for the background; the number may be printed with a fourth color and a fifth color may be used in the border.
+      );

File gap/ie_tikz.gd

+DeclareGlobalFunction("TikzArrayOfIntegers");

File gap/ie_tikz.gi

+#################
+## This function aims to produce tikz code for displaying arrays of integers.
+##
+## Input: the arguments (at most 3) are: 
+#a range or a table of integers,
+#an integer (indicating the length of the floors; it is only needed when a range is given as first argument.
+#a record of options. For details on these see the default options...
+
+  
+InstallGlobalFunction(TikzArrayOfIntegers,
+function(arg)
+  local  opt, i, array, rg, cat, flen, aux, el, node, h, utable, 
+         k, table, tikzstring, floor, nd;
+
+  opt := First(arg, a -> IsRecord(a));
+  if opt = fail then
+    opt := TikzIEmDefaultOptionsForArraysOfIntegers;
+  else
+    if IsBound(opt.cell_width) then
+      opt.allow_adjust_cell_width := "false";
+    fi;
+    for i in RecNames( TikzIEmDefaultOptionsForArraysOfIntegers ) do
+      if not IsBound(opt.(i)) then
+        opt.(i) := TikzIEmDefaultOptionsForArraysOfIntegers.(i);
+      fi;
+    od;
+  fi;
+  array := opt.highlights;
+#  Error(".");
+  
+  # the integers are put in an ordered list. The length of each floor is saved.
+  rg := ShallowCopy(First(arg, a -> not(IsRecord(a) or IsInt(a))));
+  if rg = fail then #when no range or table is given, the minimum range containing all the elements to be highlighted is taken.
+    cat := Concatenation(array);
+    rg := [Minimum(cat)..Maximum(cat)];
+  fi;
+  if IsRange(rg) then
+    flen := First(arg, a -> IsInt(a));
+    if flen = fail then
+      flen := Length(rg);
+    fi;
+  else
+    flen := Length(rg[1]);
+    rg := Concatenation(rg);
+  fi;
+  if opt.allow_adjust_cell_width <> "false" then
+    aux := Int(opt.allow_adjust_cell_width)*(LogInt(Maximum(rg),10)+1);
+    opt.cell_width := String(aux);
+
+  fi;
+
+
+
+  # process...
+  for i in [1..Length(rg)] do
+    el := rg[i];
+    node := [el];
+    for h in [1..Length(array)] do
+      if el in array[h] then
+        Add(node,h);
+      fi;
+    od;
+    rg[i] := node;
+  od;
+  utable := [];
+  for k in [1..Int(Length(rg)/flen)] do
+    Add(utable,rg{[(k-1)*flen+1..k*flen]});
+  od;
+  if not IsInt(Length(rg)/flen) then
+    Add(utable,rg{[Int(Length(rg)/flen)*flen+1..Length(rg)]});
+  fi;
+
+  table := Reversed(utable);
+
+  ##################
+  tikzstring := "%tikz\n\\begin{tikzpicture}\n";
+  Append(tikzstring,Concatenation("\\matrix[row sep=",opt.rowsep,"pt,"));
+  Append(tikzstring,Concatenation("column sep=",opt.colsep,"pt]\n{"));
+
+  for floor in table do
+    for nd in floor do
+      Append(tikzstring,"\\node[minimum width=");
+      Append(tikzstring,opt.cell_width);  
+      Append(tikzstring,"pt");
+
+      if Length(nd) = 1 then
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 2 then
+        Append(tikzstring,",fill=");
+        Append(tikzstring,opt.colors[nd[2]]);
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 3 then
+        Append(tikzstring,",left color=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",right color=");
+        Append(tikzstring,opt.colors[nd[3]]);
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 4 then
+        Append(tikzstring,",left color=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",right color=");
+        Append(tikzstring,opt.colors[nd[3]]);
+        Append(tikzstring,",middle color=");
+        Append(tikzstring,opt.colors[nd[4]]);
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 5 then
+        Append(tikzstring,",upper left=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",upper right=");
+        Append(tikzstring,opt.colors[nd[3]]);
+        Append(tikzstring,",lower left=");
+        Append(tikzstring,opt.colors[nd[4]]);
+        Append(tikzstring,",lower right=");
+        Append(tikzstring,opt.colors[nd[5]]);
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 6 then
+        Append(tikzstring,",upper left=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",upper right=");
+        Append(tikzstring,opt.colors[nd[3]]);
+        Append(tikzstring,",lower left=");
+        Append(tikzstring,opt.colors[nd[4]]);
+        Append(tikzstring,",lower right=");
+        Append(tikzstring,opt.colors[nd[5]]);
+        Append(tikzstring,",text=");
+        Append(tikzstring,opt.colors[nd[6]]);
+      Append(tikzstring,",draw");
+        Append(tikzstring,"]");
+      fi;
+      if Length(nd) = 7 then
+        Append(tikzstring,",upper left=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",upper right=");
+        Append(tikzstring,opt.colors[nd[3]]);
+        Append(tikzstring,",lower left=");
+        Append(tikzstring,opt.colors[nd[4]]);
+        Append(tikzstring,",lower right=");
+        Append(tikzstring,opt.colors[nd[5]]);
+        Append(tikzstring,",text=");
+        Append(tikzstring,opt.colors[nd[6]]);
+      Append(tikzstring,",thick,draw=");
+        Append(tikzstring,opt.colors[nd[7]]);
+       Append(tikzstring,"]");
+      fi;
+      if Length(nd) > 7 then
+        Append(tikzstring,",upper left=");
+        Append(tikzstring,opt.colors[nd[2]]);
+        Append(tikzstring,",upper right=");
+        Append(tikzstring,opt.colors[nd[3]]);
+        Append(tikzstring,",lower left=");
+        Append(tikzstring,opt.colors[nd[4]]);
+        Append(tikzstring,",lower right=");
+        Append(tikzstring,opt.colors[nd[5]]);
+        Append(tikzstring,",text=");
+        Append(tikzstring,opt.colors[nd[6]]);
+      Append(tikzstring,",ultra thick,draw=");
+        Append(tikzstring,opt.colors[nd[7]]);
+       Append(tikzstring,"]");
+      fi;
+
+      Append(tikzstring,Concatenation("{",String(nd[1]),"};&\n"));
+    od;
+    #remove "&\n"
+     Unbind(tikzstring[Length(tikzstring)]);
+    Unbind(tikzstring[Length(tikzstring)]);
+   Append(tikzstring,"\\\\\n");
+  od;
+  Append(tikzstring,"};\n \\end{tikzpicture}\n");
+  return tikzstring;
+
+end);

File gap/ie_utils.gd

+DeclareGlobalFunction("IntegersEmMakeDoc");
+DeclareGlobalFunction("ConvertDotStringTexFile");

File gap/ie_utils.gi

+InstallGlobalFunction(IntegersEmMakeDoc,
+function()
+  SetGapDocLaTeXOptions(rec(EarlyExtraPreamble:="\\usepackage{pgf}\n\\usepackage{tikz}\n\\usepgfmodule{plot}\n\\usepgflibrary{plothandlers}\n\\usetikzlibrary{shapes.geometric}\n\\usetikzlibrary{shadings}"));
+MakeGAPDocDoc(Concatenation(PackageInfo("integersem")[1]!.
+          InstallationPath, "/doc"), "IntegersEm.xml",
+          ["../PackageInfo.g","examples.xml","draw.xml"], "IntegersEm",     "MathJax");;
+end);
+
+#convert a dot string to tikz and save it into a file
+
+InstallGlobalFunction(ConvertDotStringTexFile,
+function(dotstring,filename)
+  local  command;
+  
+  FileString(Concatenation(filename,".dot"),dotstring);    
+  command := Concatenation("dot2tex -ftikz ",filename,".dot"," > ", filename,".tex");
+  Exec(command);
+end);
+
+ReadPackage("integersem/gap/ie_colors.gd");
+ReadPackage("integersem/gap/ie_options.gd");
+ReadPackage("integersem/gap/ie_tikz.gd");
+ReadPackage("integersem/gap/ie_dot.gd");
+ReadPackage("integersem/gap/ie_utils.gd");
+
+if not TestPackageAvailability("viz", "0.2.5")=fail then 
+  LoadPackage("viz");
+fi;
+
+DeclareInfoClass("InfoIntegersEm");
+ReadPackage("integersem/gap/ie_colors.gi");
+ReadPackage("integersem/gap/ie_tikz.gi");
+ReadPackage("integersem/gap/ie_dot.gi");
+ReadPackage("integersem/gap/ie_utils.gi");
+
+