diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-25 22:22:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-25 22:22:25 +0000 |
commit | 2c266513a7d7727e1adbcbfca59d5e7dbfdfd2e0 (patch) | |
tree | a8f606660c9f134ae2cc80bc4c74219eb589bd29 /Master/texmf-dist/doc/generic/petri-nets | |
parent | 86e8221f09069b58618c78721f104b3628f8fb16 (diff) |
petri-nets non-update to generic
git-svn-id: svn://tug.org/texlive/trunk@24088 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/petri-nets')
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/COPYING | 340 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/ChangeLog | 88 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/README | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/pn2pdf | 211 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/pndoc.pdf | bin | 0 -> 207808 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/petri-nets/pndoc.tex | 1234 |
6 files changed, 1892 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/petri-nets/COPYING b/Master/texmf-dist/doc/generic/petri-nets/COPYING new file mode 100644 index 00000000000..60549be514a --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Master/texmf-dist/doc/generic/petri-nets/ChangeLog b/Master/texmf-dist/doc/generic/petri-nets/ChangeLog new file mode 100644 index 00000000000..556338e519b --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/ChangeLog @@ -0,0 +1,88 @@ +2006-03-02 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.sty: fixed the detection of pdfLaTeX using ifpdf.sty, as + suggested by Jesús Cerquides <cerquide@maia.ub.es> + +2002-12-06 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.tex: changed the default size of arrowheads. + Added macros to save/show nets. + + * pndraw.sty: improved pdfLaTeX support. + + * pn2pdf, pndoc.tex: updated w.r.t. the changes in pndraw.sty + +2002-10-14 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndoc.tex: corrected some typos. + +2002-10-12 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndoc.tex: updated + + * pndraw.tex: added macro \pst to prefix PSTricks's commands + + * pndraw.sty: included support for pdfLaTeX + +2001-11-26 Franck Pommereau <pommereau@univ-paris12.fr> + + * the position of round nodes labels now uses the \labelsep + parameter. + +2001-08-28 Franck Pommereau <pommereau@univ-paris12.fr> + + * changed the definition of \choice so it draws a square. + + * added reference pages to the documentation. + +2001-06-11 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.tex: ficed a bug on stores when changing \placesize + (thanks to André Steenveld). + +2001-06-07 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.tex: moved the expansion of \everynet just before the + first net commands. + + * pndraw.tex: changed option $ for links to / since $ causes + problems. + +2001-06-05 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndoc.tex: added a remark about DVI viewers. + + * pndoc.tex: corrected a few typos. + +2001-06-04 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.tex: added more options to nodes. + + * pndoc.tex: updated for the new features. + +2001-06-02 Franck Pommereau <pommereau@univ-paris12.fr> + + * pndraw.tex: added macros \link (\arc becomes a shortcut) + \store, \module and \source asked by André Steenveld. + + * pndraw.tex: added macro \nodessize. + +2001-06-02 Franck Pommereau <pommereau@univ-paris12.fr> + + * bug fixed: pndraw.aux + (thanks to Denis Girou) + + * pndoc.tex: added some words about the compatibility with + graphics and graphicx packages, corrected some typos. + (thanks to Denis Girou) + +2001-05-28 Franck Pommereau <pommereau@univ-paris12.fr> + + * Released on CTAN + +2001-04-01 Franck Pommereau <pommereau@univ-paris12.fr> + + * Added forgotten \Rscope and \Lscope to pntext.sty + +2001-03-16 Franck Pommereau <pommereau@univ-paris12.fr> + * First release diff --git a/Master/texmf-dist/doc/generic/petri-nets/README b/Master/texmf-dist/doc/generic/petri-nets/README new file mode 100644 index 00000000000..c7750398630 --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/README @@ -0,0 +1,19 @@ +This is Petri-nets: a set of (La)TeX packages for works about Petri nets +and related models. Read pndoc.pdf for installation and usage. + + petrinets (C) 1999-2000 Franck Pommereau (pommereau@univ-paris12.fr). + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or any +later version (see file COPYING). + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA diff --git a/Master/texmf-dist/doc/generic/petri-nets/pn2pdf b/Master/texmf-dist/doc/generic/petri-nets/pn2pdf new file mode 100644 index 00000000000..c42f9c38f30 --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/pn2pdf @@ -0,0 +1,211 @@ +#!/usr/bin/perl + +## This file is part of the Petri-nets packages. See file README for +## copyright notice. + +use strict; +use Digest::MD5 qw(md5_hex); +use Getopt::Long; + +## +## read options +## + +Getopt::Long::Configure ("bundling"); + +my $keep = 0; +my $force = 0; +my $verbose = 0; + +GetOptions ("k|keep" => \$keep, + "f|force" => \$force, + "v|verbose" => \$verbose, + "t|test" => \&Test, + "d|delete" => \&Delete, + "b|batch" => \&Batch, + "h|help" => \&Help); + +&Help if scalar @ARGV > 1; + +## +## Global variables +## + +my $figure = shift @ARGV; +my $basename = $figure; $basename =~ s/\.pn$//; +my $jobname = $basename; $jobname =~ s/-fig\d+$//; +my $data = ""; +my %sum; + +## +## Load checksums +## + +if (-f "$jobname.sum") { + open SUM, "$jobname.sum" + or &Error ("could not open $jobname.sum -- $!"); + while (<SUM>) { + next unless /^(.+)\s+(.+)$/; + $sum{$1} = $2; + } + close SUM; +} + +## +## Get preamble +## + +if (-f "$jobname.pre") { + # read the existing preamble + my @lines; + open PRE, "$jobname.pre" + or &Error ("could not open $jobname.sum -- $!"); + @lines = <PRE>; + close PRE; + $data .= join "", @lines; +} else { + # create a new preamble + open TEX, "$jobname.tex" + or &Error ("could not open $jobname.tex -- $!"); + while (<TEX>) { + $data .= $_; + last if /\\begin\{document\}/; + } + close TEX; + $data =~ s/(\\begin\{document\}).*$/$1\n/; + $data .= "\\pagestyle\{empty\}\n"; + # save it + open PRE, ">$jobname.pre" + or &Error ("could not create $jobname.sum -- $!"); + print PRE $data; + close PRE; +} + +## +## Read the figure +## + +{ + my $pre = 1; + open TEX, $figure or &Error ("could not open $figure -- $!"); + open PRE, ">>$jobname.pre" + or &Error ("could not append $jobname.pre -- $!"); + while (<TEX>) { + $pre = 0 if /^\\begin\{petrinet\}/; + print PRE if $pre; + $data .= $_; + } + close TEX; + close PRE; +} + +## +## Generate the EPDF +## + +if (&SumChanged ($figure, "$data") or $force or (! -f "$basename.pdf")) { + open TEX, ">$basename.tex" + or &Error ("could not create file $basename.tex -- $!\n"); + print TEX "$data\\end\{document\}\n"; + close TEX; + system "latex", "$basename.tex"; + system "dvips", "-E", "-Ppdf", "-o", "$basename.eps", "$basename"; + system "epstopdf", "$basename.eps"; +} + +unlink ("$basename.tex", "$basename.log", "$basename.aux", + "$basename.dvi", "$basename.eps", "$basename.pn") unless $keep; + +## +## Save checksums +## + +open SUM, ">$jobname.sum" + or die "pn2pdf: could not create file $jobname.sum -- $!\n"; +foreach my $file (sort keys %sum) { + print SUM "$file $sum{$file}\n"; +} +close SUM; + +exit 0; + +## +## Sub programs +## + +sub Help { + print <<"EOF"; +Usage: pn2pdf [OPTIONS] +Create EPDF files for Petri net figures. + + FIGURE process FIGURE + -b, --batch FILE process the commands in FILE + -k, --keep keep temporary files + -f, --force force the rendering of all pictures + -t, --test FILES create FILES for test purpose + -d, --delete FILES delete FILES (may be patterns) + -h, --help display this help and exit + +Report bugs to <pommereau\@univ-paris12.fr> +EOF + exit 0; } + +sub Error { + foreach my $line (@_) { + warn "pn2pdf: $line\n"; + } + exit 1; +} + +sub Verbose { + return unless $verbose; + foreach my $line (@_) { + warn "[pn2pdf] $line\n"; + } +} + +sub SumChanged { + my ($file, $lines) = @_; + my $md5 = md5_hex ($lines); + if ($md5 eq $sum{$file}) { + return 0; + } else { + $sum{$file} = $md5; + return 1; + } +} + +sub Test { + foreach my $file (@ARGV) { + open FILE, ">$file" or &Error ("could not create $file -- $!"); + close FILE; + } + exit 0; +} + +sub Delete { + foreach my $pattern (@ARGV) { + unlink glob $pattern unless $keep; + } + exit 0; +} + +sub Batch { + my @lines; + foreach my $file (@ARGV) { + $file =~ s/(\.[a-z]{3})?$/.bpn/i; + open FILE, $file or &Error ("could not open $file -- $!"); + while (<FILE>) { + next unless /^pn2pdf\s/; + s/^pn2pdf\s/pn2pdf --keep / if $keep; + s/^pn2pdf\s/pn2pdf --force / if $force; + s/^pn2pdf\s/pn2pdf --verbose / if $verbose; + push @lines, $_; + } + close FILE; + } + foreach (@lines) { + system $_; + } + exit 0; +} diff --git a/Master/texmf-dist/doc/generic/petri-nets/pndoc.pdf b/Master/texmf-dist/doc/generic/petri-nets/pndoc.pdf Binary files differnew file mode 100644 index 00000000000..c5c05bc6e48 --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/pndoc.pdf diff --git a/Master/texmf-dist/doc/generic/petri-nets/pndoc.tex b/Master/texmf-dist/doc/generic/petri-nets/pndoc.tex new file mode 100644 index 00000000000..eb75ee734e7 --- /dev/null +++ b/Master/texmf-dist/doc/generic/petri-nets/pndoc.tex @@ -0,0 +1,1234 @@ +% This file is part of the Petri-nets packages. See file README for +% copyright notice. + +\documentclass[11pt]{article} + +\usepackage{pnets} + +\catcode`\|=\active +\def|{\verb|} + +%% +%% + +\begin{document} + +\title{Petri-nets packages} +\author{Franck Pommereau (pommereau@univ-paris12.fr)} +\date{Last update: \pnversion} +\maketitle + +\begin{abstract}\noindent +This paper describes Petri-nets, a set of \TeX/\LaTeX{} packages about +Petri nets and related models. One package allows to draw Petri-nets +in PostScript or PDF documents. One other defines macros related to +PBC, M-nets and \bpn{} models. A last package just gathers together +the two previous. +\end{abstract} + +\begin{small} +\tableofcontents +\end{small} + +%% +%% + +\section{Introduction} + +Petri-nets is a set of packages which I use to write my papers about +Petri nets and related models (essentially: PBC, M-nets and \bpn). It +features three packages: one for drawing net, one other which defines +additional macros for textual purpose (like the name ``\bpn'') and a +last one for both purposes. The first package has been designed with a +precise goal: saving me a lot of work when I have to draw nets. This +goal explains some choices I did: typesetting labels in math mode by +default, ending commands with the line, etc. I feel this results in an +intuitive and high-level way to define Petri nets, but if you have +ideas to improve this, don't hesitate to contact me. The text command +package is more classical and if it saves also a lot of typing, its +main goal is to ensure uniform notations. + +All these packages may evolve and grow up and if you (or I) feel that +a feature is missing, you can send me an e-mail explaining your needs +(\TeX{} code is welcome too). Notice that I don't pretend being a +specialist in Petri nets and I'm only used to work on three or four +models; so I may ignore particular things in particular models. This +may explain some missing features. + +%% +%% + +\subsection{Installation} + +The last version of the package may be downloaded on the web at the +URL {\it http:/\slash www.univ-paris12.fr\slash lacl\slash +pommereau\slash petrinets.tar.gz\/}, a copy should be available on +{\it CTAN\slash macros\slash generic\slash petri-nets}; the +distribution contains the following files: + +\begin{itemize} +\item |pnets.tex| is the main \TeX{} package; +\item |pnets.sty| is its \LaTeX{} counterpart; +\item |pndraw.tex| and |pndraw.sty| are the \TeX{} and \LaTeX{} + sub-packages for drawing nets; +\item |pntext.tex| and |pntext.sty| are the \TeX{} and \LaTeX{} + sub-packages for text commands; +\item |pnversion.tex| defines macro |\pnversion|; +\item |pndoc.ps|, |pndoc.pdf| and |pndoc.tex| are the present paper + and its source; +\item |COPYING| is the text of the GNU GPL; +\item |ChangeLog| collects all changes done to Petri-nets; +\item |README| is a short introduction text; +\item |pn2pdf| is a Perl script used to produce PDF files with + pdf\LaTeX. +\end{itemize} + +In order to have Petri-nets working, you need to copy files |pnets.*|, +|pndraw.*|, |pntext.*| and |pnversion.tex| in a place where \TeX{} +will be able to find them. This can be somewhere in the default search +path (see your local \TeX{} documentation) or in a directory included +in your |TEXINPUT| environment variable. + +Packages from Petri-nets have been developed and tested with +te\TeX-1.0.2 for Linux. \TeX{} packages should work with any \TeX{} +version greater than or equal to 3 (my version is 3.14159, Web2C +7.3.7). \LaTeX{} packages have been designed for \LaTeX$2_\varepsilon$ +so you may experiment troubles with an older version. + +In order to typeset symbols for classical sets of numbers (\setN, +\setR, etc.) Petri-nets uses fonts from AMS. So you must have package +|amsfonts| installed for \LaTeX{} or fonts |bbm| for \TeX{} (I think +these conditions are more or less equivalent). + +The drawing basis are provided by package PSTricks, my version is +PST97 but I used only macros described in the manual of version 0.93a +so I hope it should work with it. + +Using PSTricks has an important consequence: actual drawings are done +in PostScript, so, you may not see them directly from the DVI viewer +(at least not correctly); additionally, you must use a PostScript +driver in order to produce your final document (for example, dvips +works well). Some support to produce PDF documents with pdf{\LaTeX} is +provided (see section~\ref{sec:pdf}). + +PSTricks conflicts with packages |color|, |graphics| and |graphicx|, +Petri-nets thus inherits this conflict. If you wish to use them +together, you should first load package |pstcol|, then Petri-nets and +at last, |color|, |graphics| or |graphicx|. The following is quoted +from PSTricks' |README|: + +\begin{quote} +To use the standard `|color|' package (which is available both for +plain \TeX{} and \LaTeX) with PSTricks, you must load the `|pstcol|' +extra package written by David Carlisle, which interface the two +packages, loading them in the right order, and overriding some small +parts of PSTricks to allow it to use the `|color|' package system for +specifying color. We {\it strongly\/} recommend that you use this way +today. + +\LaTeX{} users must also take care that the `|pstcol|' package is +required in place of the `|pstricks|' one if the `|graphics|' or +`|graphicx|' package is also loaded. +\end{quote} + +If you wish to produce PDF files using pdf{\LaTeX}, you also need to +copy the script |pn2pdf| in a directory from which it can be executed. +This script requires a working Perl with the packages |Digest::MD5| +and |Getopt::Long| installed. Moreover, the script calls the following +programs: |latex|, |dvips| and |epstopdf| which must be installed on +your system (there should be not problem for the first two). In order +to include the PDF pictures, the package |graphicx| is used (in this +case, it does not lead to any conflict since PSTricks is not loaded +when running pdf\LaTeX). Finally, the package |ifpdf| is used to +detect whether a document is compiled using \LaTeX{} or pdf\LaTeX. +This package should be thus installed. + +You can test your installation by recompiling the present manual which +is written in \LaTeX. If it compiles successfully, this means that +Petri-nets and PSTricks have been found by \TeX. If one file is not +found, \TeX{} will complain, giving the file name. Then, running dvips +will ensure that the PostScript headers of PSTricks can be found. You +may also test the PDF support by producing the PDF version of this +manual, see section~\ref{sec:pdf} for the way to proceed. + +If you successfully use Petri-nets under another configuration, feel +free to send me an e-mail at {\it pommereau@univ-paris12.fr}. You may +also send bug reports or comments, they are welcome. Of course, bug +fixes are welcome too. + +%% +%% + +\subsection{Loading the packages} + +From \TeX, you can load the package with |\input pnets|, from \LaTeX, +you should put |\usepackage{pnets}| in the preamble of your document. +Since you may want to use only the drawing macros, you can use +|\input pndraw| or from \LaTeX: |\usepackage{pndraw}|. Similarly, in +order to load only text commands, you can use |\input pntext| or +|\usepackage{pntext}|. + +Both packages define a macro |\pnversion| which gives the date of the +last update of the package. The date is given as a triple of numbers +of the form |year-month-day|. + +%% +%% + +\subsection{Things to do, known bugs and problems} + +In order to draw additional labels at the right position, |pndraw| has +to perform some time consuming floating point computing. I plane in +the future to perform this directly in PostScript, in order to speed-up +\TeX{} compilation stage. + +Only transitions are allowed to change their size according to their +inner label, it may be nice to have this feature for the other +nodes. But it's may be a little bit difficult or quite ugly for some +nodes. + +I also could add looping arcs. This is useless for Petri nets but it +would allow one to use the packages for other purposes, like drawing +automata. + +The PDf pictures are clipped to the bounding box of the corresponding +net. I've seen on the newsgroups that there exists a solution, but it +was written in German which I can't read. + +When one looks at a PDF document using Acrobat Reader, small blur +points appear at the top-right and bottom-left corners of the Petri +nets. This comes from two white points added in order to force dvips +to produce the right bounding box when a net is generated alone in an +EPS file. So, this is a bug of Acrobat Reader rather than one of +Petri-nets. + +In a late future, I'd like to make the package independent of +PSTricks, so it would be more portable (but maybe less powerful). + +%% +%% + +\subsection{Legal stuff} + +Petri-nets is {\copyright} 2002 Franck Pommereau ({\it +pommereau@univ-paris12.fr\/}). + +This program is free software; you can redistribute it and/or modify +it under the terms of the {\it GNU General Public License\/} as +published by the Free Software Foundation; either version 2 of the +License, or any later version (see file |COPYING|). + +This program is distributed in the hope that it will be useful, but +{\it without any warranty\/}; without even the implied warranty of +{\it merchantability\/} or {\it fitness for a particular purpose}. +See the {\it GNU General Public License\/} for more details. + +You should have received a copy of the {\it GNU General Public +License\/} along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +%% +%% + +\subsection{Contributors} + +I am very grateful to all the persons who contributed to my work, in +particular: + +\begin{quote} +Denis Girou, +Hanna Klaudel, +Andr\'e Steenveld. +\end{quote} + +%% +%% + +\section{Text commands: package {\tt pntext}} + +This section lists the commands defined in package |pntext|, they are +all available from \TeX{} as well as from \LaTeX. + +\paragraph{Math sets.} +% +Command |\mathset{A}| produces symbol \mathset{A} (and of course it +works for any text). Shortcuts are defined: |\setN| for |\mathset{N}| +and similarly for |\setZ|, |\setQ|, |\setR| and |\setC|. + +\paragraph{Status of places.} +% +Commands |\iplace|, |\eplace| and |\xplace| produce respectively +characters \iplace, \eplace{} and \xplace. Command |\placestatus{n}| +typesets character \placestatus{n} (in the case you would like a new +place type). + +\paragraph{Operators for communication.} +% +Synchronization operator (\sy) is available through command |\sy|, in +math mode, this command is surrounded by additional white space as +usual for binary operators. Similar operators are |\rs| for +restriction and |\tie| for asynchronous links. Scoping is available +with commands |\lscope| and |\rscope| which produce respectively a +left and a right double bracket, you may also use |\scope{A}{N}| to +produce \scope{A}{N}. + +If you use |\lscope| (resp. |\rscope|) without the corresponding +|\rscope| (resp. |\lscope|) in the same equation or array cell, \TeX{} +will complain about some missing |\right| (resp. |\left|). In order to +close (resp. open) a scope without drawing the bracket, you may use +macro |\Rscope| (resp. |\Lscope|). + +\paragraph{Choice.} +% +Choice operator \choice{} is produced with command |\choice|. In math +mode, it behaves like any binary operator. + +\paragraph{\bpn.} +% +The logo of \bpn{} is typeset using command |\bpn|. A \bpn{} keyword +(say \bpnkw{program}) is typeset with |\bpnkw{program}| and for a +non-terminal in the syntax (say \bpnnt{scope}) you may use +|\bpnnt{scope}|. Function \mnet{} is defined as |\mnet|. + +\paragraph{Sets of values and variables.} +% +\Var{} and \Val{} are typeset using commands |\Var| and |\Val|. They +are better to use than directly the text they typeset because they +adjust their spacing in math mode: compare ``$Var$'' with ``$\Var$''. + +\paragraph{To be continued\dots} + +%% +%% + +\section{Drawing nets: package {\tt pndraw}} + +%% +%% + +\subsection{Some words about PSTricks} + +Reading PSTricks manual could be a good idea, but if you don't want +to, you should know a few things about it in order to use Petri-nets +successfully. + +In PSTricks, any point is designated by two coordinates in a grid, +centered on a reference point which has coordinates $(0,0)$. The +figure~\ref{axis} shows an example. + +\begin{figure}[t] +\begin{center} +\begin{petrinet}(-1.5,-1.5)(5.5,3.5) +\pst\psgrid[subgriddiv=1,griddots=10](-1,-1)(5,3) +\pst\psline{->}(0,-1.5)(0,3.5) +\pst\psline{->}(-1.5,0)(5.5,0) +\pst\psdot(4,2) +\pst\rput[br](4,2){$(4,2)$} +\pst\psdot(0,0) +\pst\rput[br](0,0){$(0,0)$} +\pst\psdot(2.5,-.5) +\pst\rput[l](2.5,-.5){$\,(2.5,-.5)$} +\end{petrinet} +\end{center} +\caption{The Cartesian coordinate system.} +\label{axis} +\end{figure} + +The distance from the origin $(0,0)$ to a point $(x,y)$ depends on +three parameters. |units| is a global scale, if |unit=1.2cm|, $(4,2)$ +becomes an abbreviation for $(4 \times 1.2\hbox{ cm}, 2 \times +1.2\hbox{ cm})$. There's also |xunit| and |yunit| which act +respectively only on horizontal or vertical scale; for example, if +|xunit=20pt| and |yunit=1in|, $(4,2)$ stands for $(4 \times 20\hbox{ +pt}, 2 \times 1\hbox{ in})$. As you can see on these short examples, +|unit|, |xunit| and |yunit| can be affected any value which is a valid +\TeX{} |dimen| (or \LaTeX{} length). + +The default value for all these three parameters is 1~cm; to change +it, you can use the |\psset| command as in |\psset{unit=.5cm}| or in a +combined way as in |\psset{xunit=1cm,yunit=2cm}|. + +Since coordinates are formed as a comma separated couple of numbers, +you {\it must not\/} use comma as decimal separator here: |(4.5,2.3)| +is correct but |(4,5,2,3)| is not. + +Sometime you'll be asked to give an angle value as a macro parameter. +In Petri-nets, angles are measured in degrees; they can be given as a +numerical value or with a one/two letter(s) code as shown in the +figure~\ref{angles}. Of course, when you specify an angle by its +numerical value, you can use any number, even negative, and not only +one of the eight values shown on figure~\ref{angles}. + +\begin{figure}[t] +\begin{center} +\begin{petrinet}[unit=2cm](-2,-1.3)(2,1.3) +\pst\pscircle(0,0){1}% +{\count0=0 % + \loop % + \ifnum\count0<360 % + \uput{.95}[\the\count0]{\the\count0}(0,0){\bf--}% + \advance\count0 by 45 % + \repeat} +\pst\uput{1.1}[0](0,0){$0=r$} +\pst\uput{1.1}[45](0,0){$45=tr/rt$} +\pst\uput{1.1}[90](0,0){$90=t$} +\pst\uput{1.1}[135](0,0){$135=tl/lt$} +\pst\uput{1.1}[180](0,0){$180=l$} +\pst\uput{1.1}[225](0,0){$225=bl/lb$} +\pst\uput{1.1}[270](0,0){$270=b$} +\pst\uput{1.1}[315](0,0){$315=br/rb$} +\end{petrinet} +\caption{Translation from angle values to letter code. $r$ is for {\it +right}, $t$ for {\it top}, $l$ for {\it left\/} and $b$ for {\it +bottom}.} +\label{angles} +\end{center} +\end{figure} + +The macro |\psset| is used to change PSTricks default parameters, it +takes one argument which is a comma-separated list of |name=value| +pairs. For example, |pndraw.tex| itself uses: +% +\begin{verbatim} +\psset{linewidth=.5pt, + doublesep=.5pt, + labelsep=2pt} +\end{verbatim} + +As you can see, blank spaces before a |name| are ignored. You already +know how to change units, some additional |name|s should be useful for +Petri-nets: + +\begin{itemize} +\item |linewidth| is the default width for {\it any\/} line drawn by + PSTricks; +\item |doubleline| can be |true| or |false|, when set to |true|, any + line drawn is doubled; +\item |doublesep| is the distance between the two lines of a doubled + line; +\item |labelsep| is the distance between an arc and its label(s); +\item |linecolor| is the color used to draw lines, it can be, for + example, |black|, |darkgray|, |gray|, |lightgray|, |white|, + |red|, |blue|, |green|, |cyan|, |magenta| or |yellow|; +\item |fillcolor| is the color used to fill shapes; you can use for it + the same colors as for |linecolor|. +\end{itemize} + +PSTricks recognizes many other parameters and you should refer to its +manual for all the details. + +%% +%% + +\subsection{Beginning and ending nets} + +To begin a net, just type |\beginnet| for \TeX{} or |\begin{petrinet}| +under \LaTeX; both this commands are expecting two pairs of +coordinates to give the bottom-left and up-right extrema of the net. + +For example, |\begin{petrinet}(-1,-2)(5,3)| starts a net which should +extend in the rectangular area, which we call the {\it bounding box}, +delimited by $(-1,-2)$ at the lower left corner and $(5,3)$ at the +upper right. These coordinates are sensitive to current values of +|unit|, |xunit| and |yunit|. + +The real effect of these two pairs is to fix the size of the bounding +box which carry the net drawn (it is actually a |\hbox| set in +horizontal mode but who cares?). If some parts of the net extends +outside of the declared bounding box, it will be drawn outside and +that's all. In other words, the bounding box announced just reserves +room for the net and the drawing itself is invisible to \TeX. This +allows you to lies about the real dimension of your drawings: you can +declare a bigger or a smaller bounding box, if you want more or less +white space around your nets. This behaviour is different when running +pdf\LaTeX, see the section~\ref{sec:pdf} for details. + +Before to give the coordinates of the bounding box for a net, you can +give optional parameters inside square brackets. These parameters are +interpreted as PSTricks options which are applied to the following net +and stay local to it. For example, if we have |unit=1cm| before +starting a net, command |\begin{petrinet}[unit=2cm](0,0)(1,1)| starts +a net with |unit=2cm| for its bounding box and any coordinate given +inside the net. But as the net ends, the previous value of |unit| is +restored. + +In order to have bounding boxes drawn in your nets: you may use +command |\showbb|, optionally followed by bracketed options. For the +figure~\ref{fig:nodes example}, I added |\showbb| at the beginning of +the net. The starred version of |\showbb| fills the background and so, +command |\showbb*[fillcolor=red]| draws a filled red rectangle over +the bounding box. + +To end the drawing, you should use |\endnet| or |\end{petrinet}| (did +you guess?). All macros between these two ones are interpreted as +PSTricks or Petri-nets commands. In the following, we call a {\it +net\/} all the stuff inclosed between |\begin{petrinet}| and +|\end{petrinet}| (if you use \LaTeX). One point has to be remembered: +inside a net, the end of line has a special meaning because it is used +to end most Petri-nets drawing commands. So if you want to use +commands spread over several lines, you have to end every line but the +last with a comment (|%|). Also notice that if you call the |\psset| +command inside a net, its effect will remain local to this particular +net. + +If you wish something to be done every time a net begins, you may set +token list |\everynet| to what you want to be inserted between command +|\begin{petrinet}| and your drawing commands. For example, with +|\everynet={\small}|, all the following nets will be set in small +types. + +Except for beginning and ending nets, all the macros are the same +under \TeX{} or \LaTeX. + +%% +%% + +\subsection{Drawing nodes} + +The available node shapes are places, transitions, modules, sources +and stores, which are drawn in figure~\ref{fig:nodes}. They are +produced with the macros |\place|, |\trans|, |\module|, |\source| and +|\store| respectively. Their size is controlled with the dimensions +|\placesize|, |\transsize|, |\modulesize|, |\sourcesize| and +|\storesize| respectively. For instance, |\transsize=8mm| sets the +size of transitions to |8mm|; |\nodessize{5mm}| sets the size of {\it +all\/} the nodes to |5mm|. + +\begin{figure} +\begin{center} +\begin{petrinet}[xunit=2cm](-.5,-.5)(4.5,1) +\place{place}(0,0) p +\label"{t}place\strut +\trans{trans}(1,0) t +\label"{t}transition\strut +\module{module}(2,0) m +\label"{t}module\strut +\source{source}(3,0) s +\label"{t}source\strut +\store{store}(4,0) labels are ignored for stores +\label"{t}store\strut +\end{petrinet} +\end{center} +\caption{The nodes available in Petri-nets.} +\label{fig:nodes} +\end{figure} + +Creating a node is possible using the command +``node\{name\}$(x,y)$label'' where: +% +\begin{itemize} +\item ``node'' is one of the above node commands; +\item ``name'' is the name of this node which should be unique for a + given net (if not, the new node overwrites the old one). This + name is case sensitive and should not contain any special + characters (as |$|, |\|, etc.); %$ +\item ``$(x,y)$'' are the coordinates of the node's center; +\item ``label'' is the text to typeset inside the node, it + extends until the end of the line. This label is silently + discarded for stores. +\end{itemize} + +For instance, the nodes in figure~\ref{fig:nodes} where drawn with the +commands: +% +\begin{verbatim} +\place{place}(0,0) p +\trans{trans}(1,0) t +\module{module}(2,0) m +\source{source}(3,0) s +\store{store}(4,0) labels are ignored for stores +\end{verbatim} + +By default, labels are typeset in math mode, if you wish a label +typeset in text mode, add option |"| after the node command. Notice +that any space after the coordinates of the node is part of the label, +it has no importance in math mode but in text mode it leads to a label +which starts with a white space. Option |=| sets double-line mode and +so the node is drawn with doubled lines. Option |!| sets the line +width to 2pt so the node appears thicker than usually. PSTricks +options may be given between square brackets, for instance adding +|[linecolor=red,linewidth=1pt]| leads to a red node with 1pt lines. + +For transitions, an additional option |*| may be used in order to have +the boundaries of the transition adjusted to the label typeset inside. +By default, the size of a node is fixed and the label overlaps outside +if too long, for transitions with option |*|, the size is just fine. + +\subsubsection{Additional labels} + +You can give additional outer labels to a node. Each label is typeset +using the macro% +% +\footnote{For \LaTeX, this means that the well known cross-referencing +macro {\tt\string\label} is not available inside a {\tt petrinet} +environment. But outside, it works as usual.} +% +|\label| which has two arguments: the first is an angle indication and +the second, which extends until the end of the line, is the text to +typeset. The angle indication is a numeric value or a code as +explained earlier. Option |"| explained above is also available for +additional labels (and should be given just after |\label|). + +Before I give an example, let me explain a useful parameter for +typesetting label: the token list |\everylabel| is expanded before any +label is typeset. For example, command |\everylabel={\scriptstyle}| +leads to typeset all the following labels in script style. This works +for really any label, not only for nodes labels. If |\everylabel| is +set inside a net, its effect will remain local to this net. + +The figure~\ref{fig:nodes example} has been typeset using the +following commands: +% +\begin{verbatim} +\begin{petrinet}[xunit=2cm](-.5,-.5)(2.5,.5) +\showbb +\place{p1}(0,0) \bullet +\trans*="{t}(1,0)~transition~ + \label"{70}more text +\place!{p2}(2,0) + \label{r} \left\{ % I can type multi-line + {\textstyle 1, 2, 3 \atop % labels, thanks to comments. + \textstyle 4, 5, 6} \right\} +\end{petrinet} +\end{verbatim} + +\begin{figure} +\begin{center} +\begin{petrinet}[xunit=2cm](-.5,-.5)(2.5,.5) +\showbb +\place{p1}(0,0) \bullet +\trans*="{t}(1,0)~transition~ + \label"{70}more text +\place!{p2}(2,0) + \label{r} \left\{ % I can type multi-line + {\textstyle 1, 2, 3 \atop % labels, thanks to comments. + \textstyle 4, 5, 6} \right\} +\end{petrinet} +\caption{Example of nodes. In the PDF, nets is clipped to its bounding + box, see section~\ref{sec:pdf}. } +\label{fig:nodes example} +\end{center} +\end{figure} + +You may notice that the net is not well centered, it extends more on +the right. This is because I declared a bounding box of $(-.5,-.5)$ to +$(2.5,.5)$ while in fact, the label of the right-most place extends on +the right, outside of the bounding box (which is made visible by the +macro |\showbb|). + +%% +%% + +\subsubsection{Free text} + +Another kind of node is unboxed text. The macro |\text| is similar to +|\trans*| but without border. Like for other nodes, the text is +typeset in math mode and it can be added outer labels with the macro +|\label|. + +This macro knows only the option |"| which has the usual meaning. + +%% +%% + +\subsection{Linking nodes} + +You can draw links between two arbitrary nodes. The package won't +check if requested links are valid from Petri nets point of view, so +you can draw an arc between two places for instance. Basically, macro +|\link| has three parameters: the name of the starting node, that of +the ending node, and the text to typeset on the link (which extends +until the end of the line). You can add optional parameters, before +the first node name: +% +\begin{itemize} +\item options inside square brackets are PSTricks options, as usual; +\item a real number, between 0 and 1, enclosed in angle brackets ({\it + e.g.}, |<.3>|) can be used to specify the position of the label, + between starting and ending nodes. Value 0 stands for ``on + the starting node'' while 1 means ``on the ending node''; the + default value is $.5$ ({\it i.e.}, on the middle of the link); +\item the characters |^|, |_| or |*| may be used to specify the side of + the link where the label is typeset. For an link which extends + from the left to the right, |^| means ``above'', |_| means + ``below'' and |*| means ``over''. If nothing is specified, the + label is placed above the link; +\item the options |"|, |=| and |!| have their usual meanings; +\item arrowheads and such can be specified between two signs |/|. + The available values are shown in the figure~\ref{fig:arrows}, + default is no arrow. +\end{itemize} + +\begin{figure} +\begin{center} +\catcode`\|=12 +\begin{petrinet}[yunit=6mm](-.6,-.3)(8,15.3) +\pst\catcode`\|=12 +\text{caption}(3,15)\rlap{none (default)} + \text"{t}(0,15){\tt -} + \text{l}(1,15) + \text{r}(2,15) + \link/-/{l}{r} +\text{caption}(3,14)\rlap{arrowheads} + \text"{t}(0,14){\tt <->} + \text{l}(1,14) + \text{r}(2,14) + \link/<->/{l}{r} +\text{caption}(3,13)\rlap{reverse arrowheads} + \text"{t}(0,13){\tt >-<} + \text{l}(1,13) + \text{r}(2,13) + \link/>-</{l}{r} +\text{caption}(3,12)\rlap{double arrowheads} + \text"{t}(0,12){\tt <{}<->{}>} + \text{l}(1,12) + \text{r}(2,12) + \link/<<->>/{l}{r} +\text{caption}(3,11)\rlap{reverse double arrowheads} + \text"{t}(0,11){\tt >{}>-<{}<} + \text{l}(1,11) + \text{r}(2,11) + \link/>>-<</{l}{r} +\text{caption}(3,10)\rlap{T-bar flush to endpoints} + \text"{t}(0,10){\tt |-|} + \text{l}(1,10) + \text{r}(2,10) + \link/|-|/{l}{r} +\text{caption}(3,9)\rlap{T-bar centred on endpoints} + \text"{t}(0,9){\tt |*-|*} + \text{l}(1,9) + \text{r}(2,9) + \link/|*-|*/{l}{r} +\text{caption}(3,8)\rlap{square brackets} + \text"{t}(0,8){\tt [-]} + \text{l}(1,8) + \text{r}(2,8) + \link/[-]/{l}{r} +\text{caption}(3,7)\rlap{rounded brackets} + \text"{t}(0,7){\tt (-)} + \text{l}(1,7) + \text{r}(2,7) + \link/(-)/{l}{r} +\text{caption}(3,6)\rlap{circles centred on endpoints} + \text"{t}(0,6){\tt o-o} + \text{l}(1,6) + \text{r}(2,6) + \link/o-o/{l}{r} +\text{caption}(3,5)\rlap{circles flush to endpoints} + \text"{t}(0,5){\tt oo-oo} + \text{l}(1,5) + \text{r}(2,5) + \link/oo-oo/{l}{r} +\text{caption}(3,4)\rlap{disks centred on endpoints} + \text"{t}(0,4){\tt *-*} + \text{l}(1,4) + \text{r}(2,4) + \link/*-*/{l}{r} +\text{caption}(3,3)\rlap{disks flush to endpoints} + \text"{t}(0,3){\tt **-**} + \text{l}(1,3) + \text{r}(2,3) + \link/**-**/{l}{r} +\text{caption}(3,2)\rlap{extended rounded ends} + \text"{t}(0,2){\tt c-c} + \text{l}(1,2) + \text{r}(2,2) + \link/c-c/{l}{r} +\text{caption}(3,1)\rlap{flush rounded ends} + \text"{t}(0,1){\tt cc-cc} + \text{l}(1,1) + \text{r}(2,1) + \link/cc-cc/{l}{r} +\text{caption}(3,0)\rlap{extended square ends} + \text"{t}(0,0){\tt C-C} + \text{l}(1,0) + \text{r}(2,0) + \link/C-C/{l}{r} +\end{petrinet} +\end{center} +\caption{The different types of links termination. They can be freely +mixed.} +\label{fig:arrows} +\end{figure} + +The order in which you use these options has no importance, provided +that all options are given before the starting node. Additionally, if +you use contradicting options, only the last used is taken into +account. For instance, the two following lines are equivalent: + +|\link_[linecolor=gray,linewidth=5pt]*<.2>^[linewidth=1pt]| + +|\link^<.2>[linecolor=gray,linewidth=1pt]|. + +To draw curved links, you should use PSTricks' |arcangle| option which +is an angle in degrees (you cannot use a letter code here), measuring +the deviation from a straight line between nodes, at the starting and +at the ending of the link. Try, it's easy. + +To change the appearance of the arrowhead, you must change PSTricks' +parameters |arrowsize|, |arrowlength| and |arrowinset|. Petri-nets +uses the following: +% +\begin{verbatim} +\psset{arrowlength=1.4, + arrowinset=0, + arrowsize=2pt 2} +\end{verbatim} +% +I wont explain how it works, just try, it's easy too. (Or read the +manual of PSTricks where all the details are given.) + +%% +%% + +\subsubsection{Additional labels} + +Like for nodes, links can be added more labels. This is also made with +the macro |\label|, but here, its syntax is like for the macro +|\link|, except that you must not specify the starting and ending +nodes (but the options of |\link| are available). + +%% +%% + +\subsubsection{Arcs} + +Since links are almost always draw with a single arrowhead at the end +(and then called {\it arcs\/}), a shortcut is provided: the macro +|\arc| may be used instead of |\link/->/|. + +%% +%% + +\section{Tips, tricks and troubleshooting} + +\paragraph{Nets as macro arguments.} +% +If you try to define a net inside the argument of a macro, you will +have an error. For instance, the code +% +\begin{verbatim} +\centerline{\begin{petrinet}(0,0)(1,1) +\place{p}(0,0) p +\trans{t}(1,1) t +\arc{p}{t} +\arc{t}{p} +\end{petrinet}} +\end{verbatim} +% +produces an error such as: +% +\begin{verbatim} +! Argument of \net:place:draw has an extra }. +<inserted text> + \par +l.11 \end{petrinet}} +\end{verbatim} + +The reason is that the macro |\centerline| reads all the net and treat +the end of lines as spaces. Similar things occur with the other +characters which are considered in a special way inside nets. The +right way to produce the desired effect is to use the macro +|\savenet|: +% +\begin{verbatim} +\savenet +\begin{petrinet}(0,0)(1,1) +\place{p}(0,0) p +\trans{t}(1,1) t +\arc{p}{t} +\arc{t}{p} +\end{petrinet} +\centerline{\shownet} +\end{verbatim} +% +the form |\savenet\begin{petrinet}| works as well and from plain +{\TeX} you should use the form |\savenet\beginnet|. After one +|\savenet| you may even use |\shownet| several times in order to +duplicate the saved net. + +\paragraph{Error messages.} +% +Sometimes, you'll get an error message such as: + +\begin{verbatim} +! Argument of \net:place:draw has an extra }. +<inserted text> + \par +l.785 \place{i3}(2,0) i_3 + +? +\end{verbatim} + +This usually means that the error was just before the line for which +\TeX{} complains (here line 785 which is correct). And usually, this +error is an omission of one of the arguments of a drawing macro. + +Another kind of message occurs quite often: + +\begin{verbatim} +PSTricks error. See User's Guide for further information. + Type H <return> for immediate help. +! Graphics parameter `rcangle' not defined.. +\@pstrickserr ... immediate help.}\errmessage {#1} + \endgroup +l.794 \arc[rcangle=30] + {ab2}{i3} \bullet +? +\end{verbatim} + +This is because on line 794, you misspelled the word ``arcangle'', +giving ``rcangle'' instead. This error is detected by PSTricks since +bracketed arguments are sent verbatim to it. + +In general, since the package |pndraw| uses a lot of tricks in order +to read the arguments of the commands, you should not trust too much +the error messages: just look at the line indicated in the message and +seek for a mistake in it or in the lines before. (Actually, this +advice can be used for almost any error message issued by \LaTeX\dots) + +\paragraph{Drawing commands on multiple lines.} +% +Inside a net, label arguments are delimited by the end of the line. To +type an argument which extends on more than one line, you should end +each line but the last with a comment~|%|. + +\paragraph{Empty node.} +% +If you want to draw ``floating'' arcs, {\it i.e.}, arcs wich are not +attached to a place or a transition, you just can anchor them on empty +texts: the following net is depicted in the figure~\ref{empty text}. + +\begin{verbatim} +\begin{petrinet}(0,0)(2,0) +\text{from}(0,0) +\text{to}(2,0) +\arc{from}{to} +\end{petrinet} +\end{verbatim} + +\begin{figure}[t] +\begin{center} +\begin{petrinet}(-.2,-.2)(2.2,.2) +\text{from}(0,0) +\text{to}(2,0) +\arc{from}{to} +\end{petrinet} +\end{center} +\caption{An arc anchored on empty texts} +\label{empty text} +\end{figure} + +\paragraph{Text mode labels.} +% +Take care of the interaction between |\everylabel| and the option |"| +which typesets a label in text mode. For example, setting +|\everylabel{\scriptstyle}| leads to an error every time a text mode +label is typeset because |\scriptstyle| is a math command. So you +should prefer the longer but safer form: |\everylabel{\ifmmode|\hskip +0pt|\scriptstyle|\hskip 0pt|\else|\hskip 0pt|\scriptsize|\hskip +0pt|\fi}|. + +\paragraph{Labels at the wrong position.} +% +If the additional labels of a node appear centered on it instead of +outside, this may come from the way you visualize your document. DVI +viewers usually do not interpret correctly all of the PostScript +commands used by PSTricks. Trying a PostScript viewer (GhostView is +certainly a good choice) may solve your problem. + +\paragraph{To be continued\dots} + +%% +%% + +\section{Producing PDF documents} +\label{sec:pdf} + +The {\LaTeX} version of |pndraw| provides some support for pdf{\LaTeX} +through the Perl script |pn2pdf| included in the archive. The usage is +quite automated, even completely if you run |pdflatex| with the option +|--shell|. If you don't want to enable this option, run first +|pdflatex|, then run |pn2pdf| |-b| |document| (assuming your file is +called |document.tex|) and finally run |pdflatex| again.\footnote{This +process was different in the previous version of the package!} Using +the option |--shell| simply allows |pdflatex| to run |pn2pdf| for you. + +Several files are produced by these different runs. You may never see +most of them since they are deleted when the become useless. {\it Take +care that none of your files uses one of these names otherwise it will +be overwrote or deleted!} +% +\begin{itemize} +\item |document.sum| is used to remember some information in order + to avoid recreating pictures if not necessary. +\item |document.|$d$ is created and deleted for test purpose when the + option |--shell| has been used, $d$ is the date when |pdflatex| + was started, as produced by the macros + |\the\year\the\month\the\day\the\time| (in the current document, + it leads to \the\year\the\month\the\day\the\time). +\item |document.bpn| is created when |pdflatex| is run without the + option |--shell|, it contains the directives for producing the + figures with |pn2pdf -b|. +\item |document.pre| is used by |pn2pdf| in order to remember the + commands (like |\psset|) issued outside of |petrinets| + environments. +\item |document-fig|$n$|.pn|, |document-fig|$n$|.tex|, + |document-fig|$n$|.aux|,\\ |document-fig|$n$|.dvi|, + |document-fig|$n$|.log|, |document-fig|$n$|.eps| are created + during the generation of |document-fig|$n$|.pdf| which contains + the rendering of the $n$th net of the document. +\end{itemize} +% +The files |document-fig|$n$|.pdf| should not be deleted before the +final document is produced since they are included from |pdflatex|. If +they are not found, a warning is issued during the compilation. + +There is several important things you should notice: +% +\begin{enumerate} +\item Everything outside of the bounding box of a net is + cropped during the creation of the PDF picture. So, take care to + check how your picture is rendered (using |\showbb| for + instance). +\item Only one pass of {\LaTeX} is made on each figure. If you need to + several passes, you may run |pn2pdf| manually, with the options + |-f| and |-k| (see below). +\item {\LaTeX} and {pdf\LaTeX} do not always produce identical + rendering of the same document. However, Petri-nets pictures + should be the same since they are always typeset by \LaTeX. +\end{enumerate} + +To conclude, here is a summary of the ways to run |pn2pdf|: +% +\begin{itemize} +\item |pn2pdf document-fig|$n$|.pn|\\ + generate |pn2pdf document-fig|$n$|.pdf| +\item the option |-f| or |--force| may be used to force the creation + of PDF files even if their source did not change. +\item |pn2pdf -t FILES| or |pn2pdf --test FILES|\\ + used by {pdf\LaTeX} in order to check is the option |--shell| + was used or not. +\item |pn2pdf -b document| or |pn2pdf --batch document|\\ + reads the file |document.bpn| in order to produce the figures. +\item |pn2pdf -d FILES| or |pn2pdf --delete FILES|\\ + deletes |FILES| (which may be patterns like |*.aux|), this is + use by |pdflatex| in order to remove some temporary files. +\item the option |-k| or |--keep| prevents |pn2pdf| from deleting the + temporary files. +\item the option |-h| or |--help| prints a short help and exit. +\end{itemize} + +%% +%% + +\newpage +\appendix + +\section{Reference pages} + +\subsection{Text commands: package {\tt pntext}} + +\begin{center} +\begin{tabular}{l@{\qquad}l} +|\bpn| & \bpn \\ +|\bpnkw{key-word}| & \bpnkw{key-word} \\ +|\bpnnt{non-terminal}| & \bpnnt{non-terminal} \\ +|\choice| & \choice \\ +|\eplace| & \eplace \\ +|\iplace| & \iplace \\ +|\lscope| & $\lscope\Rscope$ \\ +|\Lscope| & invisible version of |\lscope| \\ +|\mathset{A}| & \mathset{A} \\ +|\mnet| & \mnet \\ +|\placestatus{d}| & \placestatus{d} \\ +|\pnversion| & \pnversion{} (current version) \\ +|\rs| & \rs \\ +|\rscope| & $\Lscope\rscope$ \\ +|\Rscope| & invisible version of |\rscope| \\ +|\scope{a}{N}| & $\scope{a}{N}$ \\ +|\setC| & \setC \\ +|\setN| & \setN \\ +|\setQ| & \setQ \\ +|\setR| & \setR \\ +|\setZ| & \setZ \\ +|\sy| & \sy \\ +|\tie| & \tie \\ +|\Val| & \Val \\ +|\Var| & \Var \\ +|\xplace| & \xplace \\ +\end{tabular} +\end{center} + +\subsection{Drawing command: package {\tt pndraw}} + +\def\n{$\hookleftarrow$} +\def\<{$\displaystyle\big\langle$} +\def\>{$\displaystyle\big\rangle$} +\newenvironment{options}{\\[5pt]\begin{tabular}{@{\qquad}ll}}{\end{tabular}} + +The parts placed between angle brackets \<$\cdots$\> are the optional +ones, the others are mandatory. Symbol \n{} denotes the end of the +line. + +\begin{itemize} +\item |\arc|\<|^_*"=![|options|]<|pos|>|\>|{|node1|}{|node2|}|\<label\>\n\\ +Draws a labelled arc between node1 and node2. +\begin{options} +|^| & label above the arc (default)\\ +|_| & label below the arc \\ +|*| & label over the arc \\ +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +|<|pos|>| & position of the label ($0 \leq {}$pos${}\leq 1$) \\ +\end{options} +% +\item |\beginnet|\<|[|options|]|\>$(x_1,y_1)(x_2,y_2)$\n\\ + |\begin{petrinet}|\<|[|options|]|\>$(x_1,y_1)(x_2,y_2)$\n\\ +Begins a net whose bounding box is defined by $(x_1,y_1)$ as +bottom left corner and $(x_2,y_2)$ at top right corner. +\begin{options} +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\endnet|\\ + |\end{petrinet}|\\ +Ends a net. +% +\item |\everylabel={|\<tokens\>|}|\\ +Expands tokens each time a label is typeset. +% +\item |\everynet={|\<tokens\>|}|\\ +Expands tokens each time a net is started. +% +\item |\label|\<|"{|pos|}|label\>\n\\ + |\label|\<|"<|pos|>|label\>\n\\ +Draws an additional label for a node (first line) or a link (second +line). +\begin{options} +|"| & label in text mode \\ +|{|pos|}| & position of the label, an angle (in degrees) \\ + & or a corner code (t,l,b,r,tl,tr,bl,br) \\ +|<|pos|>| & position of the label ($0 \leq$ pos $\leq 1$)\\ +\end{options} +% +\item |\link|\<|^_*"=![|options|]<|pos|>/|arrow|/|\>|{|node1|}{|node2|}|\<label\>\n\\ +Draws a labelled link between node1 and node2. +\begin{options} +|^| & label above the arc (default) \\ +|_| & label below the arc \\ +|*| & label over the arc \\ +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +|<|pos|>| & position of the label ($0 \leq {}$pos${}\leq 1$) \\ +|/|arrow|/| & arrows specifications (see the figure~\ref{fig:arrows} \\ +\end{options} +% +\item |\module|\<|"=![|options|]|\>|{|name|}|$(x,y)$\<label\>\n\\ +Draws a labelled module centered on $(x,y)$. +\begin{options} +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\modulesize=|dimen\\ +Sets the size of the modules. +% +\item |\nodessize{|dimen|}|\\ +Sets the size of all nodes. +% +\item |\place|\<|"=![|options|]|\>|{|name|}|$(x,y)$\<label\>\n\\ +Draws a labelled place centered on $(x,y)$. +\begin{options} +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\placesize=|dimen\\ +Sets the size of the places. +% +\item |\psset{|name|=|value\<|,...|\>|}|\\ +Sets PSTricks options. +\begin{options} +|arcangle=|angle & angle at the ends of links \\ +|arrowinset=|real & size of arrowheads insets \\ +|arrowlength=|real & length of arrowheads \\ +|arrowsize=|dim integer & size of arrowheads \\ +|doubleline=|boolean & double lines on/off \\ +|doublesep=|dim & distance between double lines \\ +|fillcolor=|color & background color \\ +|labelsep=|dim & distance between labels and nodes \\ +|linecolor=|color & lines color \\ +|linewidth=|dim & lines thickness \\ +|unit=|dim & global scale \\ +|xunit=|dim & horizontal scale \\ +|yunit=|dim & vertical scale\\ +\end{options} +% +\item |\savenet|\\ +Just before the beginning of a net: saves it without displaying it. +% +\item |\showbb|\<|*[|options|]|\>\n\\ +Draws the bounding box of a net. +\begin{options} +|*| & background filled \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\shownet|\\ +Displays the last net saved by |\savenet|. +% +\item |\source|\<|"=![|options|]|\>|{|name|}|$(x,y)$\<label\>\n\\ +Draws a labelled source centered on $(x,y)$. +\begin{options} +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\sourcesize=|dimen\\ +Sets the size of sources. +% +\item |\store|\<|"=![|options|]|\>|{|name|}|$(x,y)$\n\\ +Draws a store centered on $(x,y)$. +\begin{options} +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\storesize=|dimen\\ +Sets the size of stores. +% +\item |\text|\<|"|\>|{|name|}|$(x,y)$\<label\>\n\\ +Draws an unboxed labelled node centered on $(x,y)$. +\begin{options} +|"| & label in text mode \\ +\end{options} +% +\item |\trans|\<|*"=![|options|]|\>|{|name|}|$(x,y)$\<label\>\n\\ +Draws a labelled transition centered on $(x,y)$. +\begin{options} +|*| & automatic size \\ +|"| & label in text mode \\ +|=| & double line \\ +|!| & thick line \\ +|[|options|]| & PSTricks options \\ +\end{options} +% +\item |\transsize=|dimen\\ +Sets the size of transitions. +\end{itemize} + +\end{document} |