summaryrefslogtreecommitdiff
path: root/graphics/jflap2tikz/JFLAP2TikZ.tex
blob: 281a39f9f9ca3c831acda5873d4cb3c9ff5f0213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
\documentclass[11pt]{article}

%packages
\usepackage[colorlinks,urlcolor=blue,linkcolor=blue]{hyperref}
\usepackage{tikz}
\usepackage{mathabx}
\usetikzlibrary{automata,positioning}
\usepackage{fancyhdr}
\usepackage[top=0.4in,bottom=0.4in,left=0.75in,right=0.75in,
            nofoot,head=14pt,headsep=8pt,includeheadfoot] {geometry}

%commands
\newcommand{\tkz}{Ti{\em k}Z}
\newcommand{\JFLAP}{JFLAP}
\newcommand{\jtot}{{\JFLAP}2\tkz}
\newcommand{\httpURL}[1]{\href{http://#1}{#1}}

%title
\title{\jtot}
\author{Andrew Mertz and William Slough}
\date{}

%header
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO,RE]{\jtot\ v1.1}

\begin{document}
\maketitle
\thispagestyle{empty}
\section*{Introduction}

\href{http://www.jflap.org}{\JFLAP}\footnote{\httpURL{www.jflap.org}} is a
popular Java program for experimenting with finite state machines, Turing
machines and other concepts from Formal Languages and Automata Theory. Version
7 of \JFLAP\ can export JPG, PNG, GIF, BMP, or SVG images. \jtot\ is a
\href{http://groovy.codehaus.org}{Groovy}\footnote{\httpURL{groovy.codehaus.org}} script
that converts a \JFLAP\ jff file representing a finite automaton, pushdown
automaton, or Turing machine into a \LaTeX\ file depicting the automaton
graphically using \tkz.

\section*{Requirements}

To use \jtot\ you will need \href{http://www.java.com}{Java}
installed. Additionally, you may find it useful to have
\href{http://groovy.codehaus.org}{Groovy} installed as well. You will
need to download either {\tt jflap2tikz.jar} (if you only have Java
installed) or {\tt jflap2tikz.groovy} (if you also have groovy
installed).

\section*{Usage}

\jtot\ is invoked from the command line with:
\begin{quote}
\begin{verbatim}
java -jar jflap2tikz.jar -i example.jff
\end{verbatim}
\end{quote}
or:
\begin{quote}
\begin{verbatim}
groovy jflap2tikz.groovy -i example.jff
\end{verbatim}
\end{quote}
In the above cases the output will be written to the console. Use the -h option
to see the full usage information, which is also given in
Figure~\ref{fig:usage}.

\begin{figure}
\begin{center}
\begin{verbatim}
usage: jflap2tikz [options]
Version 1.2
 -d,--accepting-distance <distance>   Distance, in pt, between the circles of an
                                      accepting state (default is 2)
 -g,--grid <size>                     Round positions so that they are on a
                                      grid. If a size is given it sets the
                                      spacing of the grid (default is 20.0)
 -h,--help                            Show usage information and quit
 -i,--input-file <filename>           Name of a JFLAP jff file representing a
                                      finite automaton, pushdown automaton, or
                                      Turing machine. If a file is not given
                                      standard input will be used.
 -k,--keep-names                      Use the state names from the JFLAP file.
                                      The default is to replace the state names
                                      with names of the form '$q_{id}$', where
                                      id is the unique state number. Note state
                                      names will not be sanitized and thus may
                                      contain invalid TeX.
 -l,--arrow-length <length>           Length of arrows in points (default is 9)
 -o,--output-file <filename>          Name of a file for writing output. If this
                                      file already exists it will be
                                      overwritten.
 -r,--rotate                          Rotate labels along edges
 -s,--scale <x>                       1 pixel in JFLAP = x points in LaTeX
                                      (default is 1.0)
 -w,--arrow-width <width>             Width of arrows in points (default is 6)
 \end{verbatim}
 \end{center}
  \caption{Usage information}
  \label{fig:usage}
\end{figure}

\section*{Examples}

The following figures show machines from the book
\href{http://www.jflap.org/jflapbook/}{JFLAP: An Interactive Formal
  Languages and Automata Package} being converted to \tkz\ using
\jtot. Note that \jtot\ currently ignores \JFLAP\ state
annotations. Furthermore, not all \JFLAP\ files will be converted
perfectly. You may have to adjust the scale and/or gridsize, or edit
the resulting \tkz\ code to achieve the effect you want. However,
\jtot\ should provide a good starting point.

\begin{figure}
  \begin{center}
    \includegraphics{examples/ex0_1a.png}
  \end{center}
  \caption{{\tt ex0.1a.jff}}
\end{figure}

\begin{figure}
  \begin{center}
    \includegraphics{examples/ex0_1a.pdf}
  \end{center}
  \caption{{\tt ex0.1a.jff} converted to \tkz\ using default values}
\end{figure}

\begin{figure}
  \begin{center}
    \includegraphics{examples/ex0_1aScale2.pdf}
  \end{center}  \caption{{\tt ex0.1a.jff} converted to \tkz\ using a scale of 2}
\end{figure}

\begin{figure}
  \begin{center}
    \includegraphics{examples/ex0_1aGrid100.pdf}
  \end{center}  \caption{{\tt ex0.1a.jff} converted to \tkz\ using a gridsize of 100}
\end{figure}

\begin{figure}
  \begin{center}
    \includegraphics[width=\textwidth]{examples/ex9-anbncn.png}
  \end{center}
  \caption{{\tt ex9-anbncn.jff}}
\end{figure}

\begin{figure}
  \begin{center}
    \includegraphics{examples/ex9-anbncn.pdf}
  \end{center}
    \caption{{\tt ex9-anbncn.jff} converted to \tkz\ using a gridsize of
    50 and label rotations on}
\end{figure}

\newpage

\section*{License}

\jtot\ and its documentation are licensed under an MIT style license

\begin{verbatim}
  Copyright (c) 2009, 2014, 2015 Andrew Mertz and William Slough

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
\end{verbatim}

\end{document}

% LocalWords:  JFlap TikZ jff documentclass LocalWords filename gridsize nofoot
% LocalWords:  includeheadfoot anbncn codehaus www jflap jflapbook
% LocalWords:  NONINFRINGEMENT