| 1 |
\documentclass[12pt]{article} |
| 2 |
\usepackage{url,xspace} |
| 3 |
\usepackage[a4paper,text={16cm,22.7cm},centering]{geometry} |
| 4 |
|
| 5 |
\usepackage[pdflatex,recompilepics=true]{gastex} |
| 6 |
\gasset{frame=false,Nw=6,Nh=6,loopdiam=5} |
| 7 |
|
| 8 |
\parindent=0pt |
| 9 |
\parskip=1.5ex |
| 10 |
|
| 11 |
\newcommand\GasTeX{\textsf{GasTeX}\xspace} |
| 12 |
\newcommand{\leftend}{{\vdash}} |
| 13 |
\newcommand{\rightend}{{\dashv}} |
| 14 |
|
| 15 |
\title{\GasTeX: Graphs and Automata Simplified in \TeX} |
| 16 |
\author{Paul Gastin \\[1ex] |
| 17 |
LMF, ENS Paris-Saclay \\ |
| 18 |
{\small\texttt{[email protected]}}} |
| 19 |
\date{v3.1} |
| 20 |
\begin{document} |
| 21 |
\maketitle |
| 22 |
\begin{abstract} |
| 23 |
This is a very minimal startup guide including some examples. |
| 24 |
\end{abstract} |
| 25 |
|
| 26 |
\begin{gpicture}[name=gpic:LR-concat,ignore] |
| 27 |
\gasset{Nframe=n} |
| 28 |
\node(ui)(15,3){$u$} |
| 29 |
\node(ui+1)(45,3){$v$} |
| 30 |
\gasset{AHnb=0} |
| 31 |
\drawline(0,2)(0,-31) |
| 32 |
\drawline(30,2)(30,-31) |
| 33 |
\drawline(60,2)(60,-31) |
| 34 |
\gasset{AHnb=1,arcradius=0.8} |
| 35 |
\drawline(0,-1)(20,-1)(20,-3)(5,-3)(5,-5)(30,-5) |
| 36 |
\node(x0)(23,-2){$\rho_0$} |
| 37 |
\drawline[linecolor=red](30,-5)(50,-5)(50,-7)(35,-7)(35,-9)(45,-9)(45,-11)(30,-11) |
| 38 |
\node(x0)(53,-6){\color{red}$\rho_1$} |
| 39 |
\drawline[linecolor=red](30,-11)(20,-11)(20,-13)(25,-13)(25,-15)(18,-15)(18,-17)(30,-17) |
| 40 |
\node(x1)(17,-12){\color{red}$\rho_2$} |
| 41 |
\drawline[linecolor=red](30,-17)(40,-17)(40,-19)(30,-19) |
| 42 |
\node(x2)(43,-18){\color{red}$\rho_3$} |
| 43 |
\drawline[linecolor=red](30,-19)(15,-19)(15,-21)(22,-21)(22,-23)(10,-23)(10,-25)(30,-25) |
| 44 |
\node(x3)(12,-20){\color{red}$\rho_4$} |
| 45 |
\drawline(30,-25)(50,-25)(50,-27)(40,-27)(40,-29)(60,-29) |
| 46 |
\node(x2)(53,-26){$\rho_5$} |
| 47 |
\gasset{Nw=1.6,Nh=1.6,Nfill=y,ExtNL=y,NLdist=.7} |
| 48 |
\node[NLangle=45](p)(0,-1){$p$} |
| 49 |
\node[fillcolor=red,NLangle=45](p1)(30,-5){\color{red}$p_1$} |
| 50 |
\node[fillcolor=red,NLangle=135](p2)(30,-11){\color{red}$p_2$} |
| 51 |
\node[fillcolor=red,NLangle=45](p3)(30,-17){\color{red}$p_3$} |
| 52 |
\node[fillcolor=red,NLangle=-135](p4)(30,-19){\color{red}$p_4$} |
| 53 |
\node[fillcolor=red,NLangle=45](p5)(30,-25){\color{red}$p_5$} |
| 54 |
\node[NLangle=0](q)(60,-29){$q$} |
| 55 |
\end{gpicture} |
| 56 |
\begin{gpicture}[name=gpic:LL-concat,ignore] |
| 57 |
\gasset{Nframe=n} |
| 58 |
\node(ui)(15,3){$u$} |
| 59 |
\node(ui+1)(45,3){$v$} |
| 60 |
\gasset{AHnb=0} |
| 61 |
\drawline(0,2)(0,-31) |
| 62 |
\drawline(30,2)(30,-31) |
| 63 |
\drawline(60,2)(60,-31) |
| 64 |
\gasset{AHnb=1,arcradius=0.8} |
| 65 |
\drawline(0,-1)(20,-1)(20,-3)(5,-3)(5,-5)(30,-5) |
| 66 |
\node(x0)(23,-2){$\rho_0$} |
| 67 |
\drawline[linecolor=red](30,-5)(50,-5)(50,-7)(35,-7)(35,-9)(45,-9)(45,-11)(30,-11) |
| 68 |
\node(x0)(53,-6){\color{red}$\rho_1$} |
| 69 |
\drawline[linecolor=red](30,-11)(20,-11)(20,-13)(25,-13)(25,-15)(18,-15)(18,-17)(30,-17) |
| 70 |
\node(x1)(17,-12){\color{red}$\rho_2$} |
| 71 |
\drawline[linecolor=red](30,-17)(40,-17)(40,-19)(30,-19) |
| 72 |
\node(x2)(43,-18){\color{red}$\rho_3$} |
| 73 |
\drawline[linecolor=black](30,-19)(15,-19)(15,-21)(22,-21)(22,-23)(10,-23)(10,-25)(15,-25) |
| 74 |
(15,-27)(0,-27) |
| 75 |
\node(x3)(12,-20){\color{black}$\rho_4$} |
| 76 |
\gasset{Nw=1.6,Nh=1.6,Nfill=y,ExtNL=y,NLdist=.7} |
| 77 |
\node[NLangle=45](p)(0,-1){$p$} |
| 78 |
\node[fillcolor=red,NLangle=45](p1)(30,-5){\color{red}$p_1$} |
| 79 |
\node[fillcolor=red,NLangle=135](p2)(30,-11){\color{red}$p_2$} |
| 80 |
\node[fillcolor=red,NLangle=45](p3)(30,-17){\color{red}$p_3$} |
| 81 |
\node[fillcolor=red,NLangle=-135](p4)(30,-19){\color{red}$p_4$} |
| 82 |
\node[NLangle=180](q)(0,-27){$q$} |
| 83 |
\end{gpicture} |
| 84 |
|
| 85 |
|
| 86 |
For the documentation, please see \url{http://www.lsv.fr/~gastin/gastex/index.html}. |
| 87 |
Solutions to known problems can be found in this page. In particular, some problems which |
| 88 |
started with TeXLive 2021 and related to the use of the document class |
| 89 |
\textsf{lipics-v2021}, or the package \textsf{todonotes}, or the library \textsf{shadows} of |
| 90 |
\textsf{tikz}, and possibly other contexts. |
| 91 |
|
| 92 |
|
| 93 |
The package consists of two files \verb|gastex.sty| and \verb|gastex.pro|. |
| 94 |
\begin{itemize} |
| 95 |
\item \verb|gastex.sty| contains the definition of all \GasTeX macros. |
| 96 |
This file could be in your working folder but it is best placed where \verb|.sty| files are, e.g., |
| 97 |
|
| 98 |
\verb|.../texmf-dist/tex/latex/gastex/gastex.sty| \\ |
| 99 |
or \\ |
| 100 |
\verb|.../texmf-local/tex/latex/gastex/gastex.sty| |
| 101 |
|
| 102 |
\item \verb|gastex.pro| which contains all the postscript procedures used to actually draw the pictures. |
| 103 |
This file could be in your working folder but it is best placed where \verb|.pro| files are, e.g., |
| 104 |
|
| 105 |
\verb|.../texmf-dist/dvips/gastex/gastex.pro| \\ |
| 106 |
or \\ |
| 107 |
\verb|.../texmf-local/dvips/gastex/gastex.pro| |
| 108 |
\end{itemize} |
| 109 |
|
| 110 |
This documentation file simply contains a few simple examples on how to make figures with |
| 111 |
\GasTeX. It should be compiled with |
| 112 |
\begin{quote} |
| 113 |
\verb|pdflatex --shell-escape gastex-doc.tex| \\ |
| 114 |
or \\ |
| 115 |
\verb|pdflatex --enable-write18 gastex-doc.tex| |
| 116 |
\end{quote} |
| 117 |
|
| 118 |
The first example below is a 2-way deterministic finite state transducer. It consists of |
| 119 |
a \verb|gpicture| environment which contains the \GasTeX commands for nodes and |
| 120 |
transitions. |
| 121 |
|
| 122 |
\begin{center} |
| 123 |
\begin{gpicture}[name=gpic:2DFT] |
| 124 |
\gasset{Nframe=y,Nw=8,Nh=8,loopdiam=6} |
| 125 |
\unitlength=2.8mm |
| 126 |
\node[Nmarks=i](0)(0,0){$q_0$} |
| 127 |
\node(1)(10,0){$q_1$} |
| 128 |
\node[Nmarks=r](2)(20,0){$q_2$} |
| 129 |
\node(6)(30,0){$q_3$} |
| 130 |
\node(3)(30,-8){$q_4$} |
| 131 |
\node(4)(20,-8){$q_5$} |
| 132 |
\node(5)(10,-8){$q_6$} |
| 133 |
|
| 134 |
\drawloop(0){$\leftend/\varepsilon,+1$} |
| 135 |
\drawloop(1){$a/\varepsilon,+1$} |
| 136 |
\drawloop(2){$\rightend/\varepsilon,+1$} |
| 137 |
\drawloop(6){$a/\varepsilon,+1$} |
| 138 |
\drawloop[loopangle=-90](3){$a/a,-1$} |
| 139 |
\drawloop[loopangle=-90](4){$a/b,-1$} |
| 140 |
\drawloop[loopangle=-90](5){$a/\varepsilon,+1$} |
| 141 |
|
| 142 |
\drawedge(0,1){$b/\varepsilon,+1$} |
| 143 |
\drawedge(1,2){$b/\varepsilon,+1$} |
| 144 |
\drawedge[ELpos=25,ELdist=0,ELside=r](2,3){$b/\varepsilon,-1$} |
| 145 |
\drawedge[ELpos=50](6,3){$b/\varepsilon,-1$} |
| 146 |
\drawedge[ELside=l](3,4){$b/\varepsilon,-1$} |
| 147 |
\drawedge[ELpos=50](4,5){$b/\varepsilon,+1$} |
| 148 |
\drawedge[ELpos=50](5,1){$b/\varepsilon,+1$} |
| 149 |
\drawedge(2,6){$a/\varepsilon,+1$} |
| 150 |
\end{gpicture} |
| 151 |
\end{center} |
| 152 |
|
| 153 |
The second one is in Figure~\ref{fig:LR-concat}. The pictures have been defined at the |
| 154 |
beginning of the \LaTeX\ document, with the \verb|name| and \verb|ignore| optional |
| 155 |
parameters given to the \verb|gpicture| environment. These pictures are generated but not |
| 156 |
inserted immediately. Instead, the \verb|\gusepicture| command allows to include each |
| 157 |
named picture, possibly multiple times at different places. |
| 158 |
|
| 159 |
All pictures defined in \verb|gpicture| environments are compiled and stored in a file |
| 160 |
called \verb|filename-pics.pdf|, one picture per page. These pictures could be included |
| 161 |
in any \LaTeX\ file, possibly another \LaTeX\ file which need not use the \GasTeX package, |
| 162 |
simply by using \verb|\includegraphics| as follows: |
| 163 |
\begin{quote} |
| 164 |
\verb|\includegraphics[page=2,scale=0.6]{gastex-doc-pics.pdf}| |
| 165 |
|
| 166 |
\includegraphics[page=2,scale=0.6]{gastex-doc-pics.pdf} |
| 167 |
\end{quote} |
| 168 |
This is convenient for instance when sending the \LaTeX\ file to \verb|Arxiv| or to an |
| 169 |
editor (journal, proceedings) which does not allow the \verb|--shell-escape| option when |
| 170 |
compiling with \verb|pdflatex|. Actually, \GasTeX does this automatically for you. When |
| 171 |
loading the package, set the \verb|recompilepics| option to \verb|false| as follows: |
| 172 |
\begin{quote} |
| 173 |
\verb|\usepackage[pdflatex,recompilepics=false]{gastex}| |
| 174 |
\end{quote} |
| 175 |
then you may compile without the \verb|--shell-escape| option |
| 176 |
\begin{quote} |
| 177 |
\verb|pdflatex gastex-doc.tex| |
| 178 |
\end{quote} |
| 179 |
and \GasTeX automatically calls \verb|\includegraphics| to include the pictures that have |
| 180 |
been previously generated and stored in the file \verb|gastex-doc-pics.pdf|. |
| 181 |
|
| 182 |
\begin{figure}[htb] |
| 183 |
\centering |
| 184 |
\gusepicture{gpic:LR-concat} |
| 185 |
\hfill |
| 186 |
\gusepicture{gpic:LL-concat} |
| 187 |
\caption{Decomposition of a left-right run and a left-left run over the product $w=uv$.} |
| 188 |
\label{fig:LR-concat} |
| 189 |
\end{figure} |
| 190 |
|
| 191 |
|
| 192 |
\end{document} |
| 193 |
|