summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pawpict/pawpict.dtx
blob: 65aedf19543ad7194df6d92f58896ff988ad11b9 (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
% \iffalse 
%<*copyright>
% pawpict macros for use with LaTeX and PAW
% $Header: pawpict.dtx,v 1.0 97/12/24 14:43:14 sdc Exp $
%$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1997 Christian Holm.
%
% The pawpict package 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.
%
% The pawpict package 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., 675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% @LaTeX-style-file{
%%    Author     = "Christian Holm",
%%    Version    = "1.0",
%%    Date       = "1997/12/24",
%%    Time       = "14:43:14",
%%    Filename   = "pawpict.sty",
%%    Address    = "Niels Bohr Institute of Physics
%%                  University of Copenhagen
%%                  Denmark",
%%    Email      = "cholm@fys.ku.dk (Internet)",
%%    CodeTable  = "ISO/ASCII",
%%    Keywords   = "LaTeX2e, PAW, graphics",
%%    Supported  = "yes",
%%    Abstract   = "LaTeX package for providing easy inclusion of
%%                  graphics made in PAW"
%% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%</copyright>
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\RecordChanges
\CodelineIndex
\typeout{Expect some Under- and overfull boxes}
\begin{document}
  \DocInput{pawpict.dtx}
\end{document}
% \fi
%
%\newcommand{\CERNLIB}{\textsc{cernlib}\index{CERNLIB}}
%\newcommand{\CMZ}{\textsc{cmz}\index{CMZ}}
%\newcommand{\COMIS}{\textsc{comis}\index{COMIS}}
%\newcommand{\CSPACK}{\textsc{cspack}\index{CSPACK}}
%\newcommand{\FATMEN}{\textsc{fatmen}\index{FATMEN}}
%\newcommand{\GEANT}{\textsc{geant}\index{GEANT}}
%\newcommand{\GKS}{\textsc{gks}\index{GKS}}
%\newcommand{\HBOOK}{\textsc{hbook}\index{HBOOK}}
%\newcommand{\HEPDB}{\textsc{hepdb}\index{HEPDB}}
%\newcommand{\HIGZ}{\textsc{higz}\index{HIGZ}}
%\newcommand{\HPLOT}{\textsc{hplot}\index{HPLOT}}
%\newcommand{\KUIP}{\textsc{kuip}\index{KUIP}}
%\newcommand{\MINUIT}{\textsc{minuit}\index{MINUIT}}
%\newcommand{\PATCHY}{\textsc{patchy}\index{PATCHY}}
%\newcommand{\PAW}{\textsc{paw}\index{PAW}}
%\newcommand{\SIGMA}{\textsc{sigma}\index{SIGMA}}
%\newcommand{\PAWPP}{\textsc{paw++}\index{PAW++}}
%\newcommand{\WWW}{\textsc{www}\index{WWW}}
%\newcommand{\VAXTAP}{\textsc{vaxtap}\index{VAXTAP}}
%\newcommand{\ZEBRA}{\textsc{zebra}\index{ZEBRA}}
%
%\def\fileversion{v1.0} 
%\def\filedate{97/12/24}
%\def\docdate {97/12/24}
%\def\bs{{\tt\char'134}}
%\newcommand{\Lcs}[1]{{\bs\tt#1}}
%
%\def\SpecialOptIndex#1{%
%    \index{#1\actualchar{\protect\ttfamily#1}
%           (option)\encapchar usage}%
%    \index{options:\levelchar{\protect\ttfamily#1}\encapchar
%           usage}}
%\def\DescribeOption{\leavevmode
%   \begingroup\MakePrivateLetters\DescribeOPT}
%\def\DescribeOPT#1{\endgroup
%              \marginpar{\raggedleft\PrintDescribeMacro{#1}}%
%              \SpecialOptIndex{#1}\ignorespaces}
%\def\SpecialPawIndex#1{%
%    \index{#1\actualchar{\protect\ttfamily#1}
%           (\textsc{paw} command)\encapchar usage}%
%    \index{paw\actualchar{\protect\textsc{paw} command:}%
%      \levelchar{\protect\ttfamily#1}\encapchar
%           usage}}
%\def\DescribePaw{\leavevmode
%   \begingroup\MakePrivateLetters\Describe@Paw}
%\def\Describe@Paw#1{\endgroup
%              \marginpar{\raggedleft\PrintDescribeMacro{#1}}%
%              \SpecialPawIndex{#1}\ignorespaces}
% 
% \DoNotIndex{\@ne,\advance,\begin,\char,\closein,\def,\DeclareOption}
% \DoNotIndex{\divide,\docdate,\else,\end,\fi,\filedate,\fileversion}
% \DoNotIndex{\framebox,\global,\ifdim,\ifeof,\ifnum,\ifx,\let,\loop}
% \DoNotIndex{\makebox,\mbox,\mutliply,\NeedsTeXFormat,\newcommand}
% \DoNotIndex{\newcount,\newdim,\newenvironment,\newif,\newsavebox}
% \DoNotIndex{\noindent,\openin,\PackageWarning,\par,\ProcessOptions}
% \DoNotIndex{\ProvidesPackage,\put,\relax,\repeat,\RequirePackage}
% \DoNotIndex{\rule,\savebox,\space,\tempa,\textsc,\tt,\undefined}
% \DoNotIndex{\usebox}
%
% \changes{v1.0}{97/12/24}{The creation of \textsf{pawpict}}
%
% \title{The \textsf{pawpict}--package\thanks{%
%    This package is based on output from \textsc{paw}.
%    This file has version number \fileversion{} dated \filedate{}.
%    The documentation was last revised on \docdate.
%       }}
% \author{Christian Holm\thanks{Due thancks to the creators of \textsc{paw}}}
%
% \date{\docdate}
% 
% \maketitle
% \begin{abstract}
%   This package is for use with \textsc{paw} as distributed from the
%   \textsc{cernlib}. It is intended to make it easier to include
%   pictures made in \textsc{paw} in \LaTeX{} documents. However, this
%   package is really only usefull if more then one such picture is
%   included in the document.
% \end{abstract}
%
% \tableofcontents
%
% \section{Motivation for use of \texttt{pawpict}}
%
% When you in \PAW{} create a picture for use in \LaTeX{}, you have
% the option of either making a (Encapsulated) Postscript file, and
% include this in your document by doing something like:
% \begin{verbatim}
%   \begin{figure}
%     \epsffile{example.eps}
%     \caption{Example of Encapsulated PostScript in \LaTeX{}.}
%     \label{EXAMPLE_EPS}
%     \end{figure}
% \end{verbatim}
% or you can create a Encapsulated \LaTeX{} file and include it with
% something like:
% \begin{verbatim}
%   \begin{figure}
%     \include{example.tex}
%     \caption{Example of Encapsulated \LaTeX{} in \LaTeX{}.}
%     \label{EXAMPLE_TEX}
%     \end{figure}
% \end{verbatim}
% 
% Now the \LaTeX{} version has the obvoius advantage, that they take
% up less disk space\footnote{Postscript Files are notriously big},
% and also, % you can view these files on \textit{any}
% \texttt{dvi}--previewer\footnote{Some \texttt{dvi}--previewers do
% not understand the \Lcs{special}  command needed for Postscript
% files}.
%
% However, the \LaTeX{} generated by \PAW{} tends to be rather long
% and hard to read, making it diffecult to make changes, or just get a
% clear picture of what is going on. Therefore, it would be nice to
% \textit{reduce} the size of these files, and make them easier to
% understand, as well as saving disk space.
%
% This package realizes this, by making the common commands needed for
% pictures generated by \PAW{} (actually \HIGZ{}) avaliable in one
% style file to be included by \Lcs{usepackage\{pawpict\}}
%
% \DescribeEnv{noborder}
% The option \texttt{noborder} is avaliable for the \texttt{pawpict}
% package. Pass the option \texttt{noborder} to pawpict, if you in
% \PAW{} have created the pictures without borders. Else do nothing.
%
% \section{How to use  \texttt{pawpict}}
%
% \subsection{Things to do in \PAW{}}
% To create a \LaTeX{} file containing a picture produced by \HIGZ{},
% do the following in \PAW{}:
% \begin{enumerate}
%   \item First you must open a file (in the current directory), and
%   assign it a Logical Unit Number (LUN). This is done by:
%   \DescribePaw{FORTRAN/FILE}
%   \begin{quote}
%      \texttt{FORTRAN/FILE} \textsl{LUN~FNAME} \texttt{[}
%      \textsl{STATUS} \texttt{]}
%   \end{quote}
%   where \textsl{LUN} is any integer\footnote{LUN 10 is used by
%   \PAW{} as \texttt{paw.metafile}}, \textsl{FNAME} is a valid file
%   name and \textsl{STATUS} can be any of:
%   \begin{description}
%    \item{OLD}       Open existing file for reading.
%    \item{APPEND}    Open existing file and position at EOF.
%    \item{NEW}       Create new file; error if already existing.
%    \item{UNKNOWN}   Open existing or create new file.
%    \item{DONTKNOW}  Like UNKNOWN except on VMS opens highest cycle.
%   \end{description}
%   Default is UNKNOWN.
%   \item Second, you should tell \HIGZ{} that it should create output
%   on a file and this is to be in the \LaTeX{} format. This is
%   accompliced in \PAW{} by:
%   \DescribePaw{GRAPHICS/METAFILE}
%   \begin{quote}
%     \texttt{GRAPHICS/METAFILE} [$\pm$]\textsl{LUN} -777
%     \textsl{FNAME} 
%   \end{quote}
%   where \textsl{LUN} is the Logical Unit Number, and \textsl{FNAME}
%   is the filename, used in 1. If \textsl{LUN} is provided negative,
%   then the picyures will \emph{not} be output on the display, but
%   only in the file. 
%   \item Now create what ever picture you may need, using zones,
%   superimpose, etc. However, do \emph{only} create one picture.
%   \item Lastly, you \emph{must} close the file:
%   \DescribePaw{FORTRAN/CLOSE}
%   \begin{quote}
%     \texttt{FORTRAN/CLOSE} \textsl{LUN}
%   \end{quote}
%   still using the \textsl{LUN} created in 1.
% \end{enumerate}
%
% Now you have a file in your current directory, containing \LaTeX{}
% commands to draw the picture created by \HIGZ{}. 
%
% There is an example of what might be in such a file (a lot is left
% out) in Figure~\ref{exa:higzfile} 
% \begin{figure}[htbp]\label{exa:higzfile}
% \begin{verbatim}
% HIGZ version 1.23/07 LaTeX metafile created  97/12/11   23.58
% \ifx\higzunit\undefined\unitlength=0pt{}
% \else\unitlength=\higzunit\fi
% \ifdim\unitlength=0pt\unitlength=\textwidth
% \divide\unitlength 2000\fi\par\noindent
% \begin{picture}(2000,2000)(0,0)
% \ifx\higzdraft\undefined\newcount
% \higzdraft\higzdraft=0{}\fi\ifnum\higzdraft>0
% \put(0,0){\framebox(2000,2000){}}
% \else\ifx\higzstep\undefined\newcount\higzstep\higzstep=0{}\fi
% \ifnum\higzstep<1\higzstep=2\fi
% ...
% \def\higzstroke#1,#2,#3,#4;{
% \advance\higzloffs\higzllen
% \ifnum\higzloffs>#1\advance\higzloffs-\higzllen\advance\higzloffs-#1
% \higzloffs=-\higzloffs\ifnum#2>0
% \put(\higzlx,\higzly){\line(#3,#4){\higzloffs}}\fi\
% ifnum#2<0\put(\higzlx,\higzly){\circle*{0}}\fi
% \higztemp=\higzloffs\multiply\higztemp#3
% \advance\higzlx\higztemp\higztemp=\higzloffs
% \multiply\higztemp#4\advance\higzly\higztemp
% \advance\higzllen-\higzloffs\higzloffs=#1
% \else\ifnum#2>0
% \put(\higzlx,\higzly){\line(#3,#4){\higzllen}}
% \fi\ifnum#2<0\put(\higzlx,\higzly){\circle*{0}}
% \fi\higzllen=0\fi}
% ...
% % End of Initialisation
% \let\higzline=\higzsolid
% \put(0,0){\framebox(2268,2268){}}
% \put(227,227){\framebox(1814,1814){}}
% \m1058,76;\s-1,3;\s-5,1;\r4;\s-5,-1;
% \s-1,-3;\s1,-3;\s3,-2;\s8,-1;\s3,-2;\s1,-3;
% \D1;\s-1,-4;\s-5,-1;\r4;\s-5,1;\s-1,4;
% \m1067,91;\s2,-2;\s1,2;\s-1,1;\s-2,-1;\m1069,80;
% ...
% \fi\end{picture}
% \end{verbatim}
% \caption{Example of a picture created by  \HIGZ{}} 
% \end{figure}
%
% \subsection{Things to do in an editor}
%
% The file created by \HIGZ{} contains
% \emph{all} the commands needed, but since a lot of these commands
% are also in style file \texttt{pawpict}, you need to take some of
% the definitions out of the file, created by \HIGZ{}.
%
% Open the newly created file in you favorite ASCII editor, and then
% delete up to the line saying
% \texttt{\% End of Initialisation}, and then save the file.
%
% The next step needed, is to edit your \LaTeX{} document, making
% paragraphs, text, tables, figures, etc and include the picture made
% by \HIGZ{}. More on this in the next section.
%
% \subsection{Things to do in document}
%  
% The picture should be included in some \textsc{figure}
% enviroment. To do this easely, \DescribeEnv{pawfig} use the
% \texttt{pawfig} enviroment. It takes one mandatory argument, the
% caption to put under the figure. It also has a optional
% argument. The optional argument is the width of the figure (defaults
% amounts to full page width).
%
% In any case, the \texttt{pawfig} environment, should be used as:
% \begin{quote}
% \Lcs{begin\{pawfig\}[}\textsl{option}\texttt{]\{}\textsl{caption}\texttt{\}}\\
%  \Lcs{input\{}\textsl{filename}\texttt{\}}\\
% \Lcs{end\{pawfig\}}\\
% \end{quote}
%
% \DescribeEnv{pawpict}
% Also, if you like, you can provide the figure enironment yourself,
% but then you should use the \texttt{pawpict} enviroment, wich takes
% no arguments. It is used like this:
% \begin{quote}
% \Lcs{begin\{pawpict\}}\\
%  \Lcs{input\{}\textsl{filename}\texttt{\}}\\
% \Lcs{end\{pawfig\}}\\
% \end{quote} 
%
% \DescribeEnv{pawfigure}
% This is a simple environment, that takes two mandatory arguments:
% the width and the caption. Optional argument is the placement.  
%
% \section{The User Commands}
% 
% In this part we describe the commands,
% which you have at your disposal in the present style.
% 
% \DescribeMacro{\pawdraft}
% You can use the command \Lcs{pawdraft} to control the output
% of the pictures made by \HIGZ{}. If this is set, no picture 
% will be drawn, instead, a frame of the size of the picture 
% is produced, at the place where the picture would go.
%
% \DescribeMacro{\pawfigplacement}
% This macro takes one argument, the placement of the figure
% floats. Notice this is meaningless if you use the \texttt{floatflt}
% package. The placement parameters are in the standard \LaTeX{} form.
% (\texttt{h}ere, \texttt{t}op, \texttt{b}ottom,
% or \texttt{p}age, in any combination. Default is \texttt{htbp}.)
% 
% \DescribeMacro{\pawincludepict}
% This macro includes a file, putting it in a \texttt{pawpict}
% environment. The mandaory argument is the filename, the optional is
% the width of the picture.
%
% \DescribeMacro{\pawincludefig}
% Much like above, only it is put in a \texttt{pawfig} environment,
% with to mandatory arguments, the filename, and the
% caption. Optionally the width of the figure may be specified.
%
% \DescribeMacro{\pawincludefigure}
% Much like above, only it is put in a \texttt{pawfigure} environment,
% with three mandatory arguments, the filename, the width, and the
% caption. Optionally the placement of the figure may be specified.
%
% There are also some commands for producing simple text 
% inserts. These are listed in Table~\ref{tab:short}. They are 
% basically convinient shorthand macroes for various text inserts,
% but also makes and index entry to that keyword.
%
% \begin{table}[htbp]
%   \label{tab:short}
%   \begin{tabular}{l l}
%     \textbf{Command}&\textbf{Resault}\\
%       \Lcs{CERNLIB}&  \textsc{cernlib}\\
%       \Lcs{CMZ}&      \textsc{cmz}\\
%       \Lcs{COMIS}&    \textsc{comis}  \\
%       \Lcs{CSPACK}&   \textsc{cspack}  \\
%       \Lcs{FATMEN}&   \textsc{fatmen} \\
%       \Lcs{GEANT}&    \textsc{geant}  \\
%       \Lcs{GKS}&      \textsc{gks}    \\
%       \Lcs{HBOOK}&    \textsc{hbook}  \\
%       \Lcs{HEPDB}&    \textsc{hepdb}  \\
%       \Lcs{HIGZ}&     \textsc{higz}   \\
%       \Lcs{HPLOT}&    \textsc{hplot}  \\
%       \Lcs{KUIP}&     \textsc{kuip}   \\
%       \Lcs{MINUIT}&   \textsc{minuit} \\
%       \Lcs{PATCHY}&   \textsc{patchy} \\
%       \Lcs{PAW}&      \textsc{paw}    \\
%       \Lcs{SIGMA}&    \textsc{sigma}  \\
%       \Lcs{PAWPP}&    \textsc{paw++}  \\
%       \Lcs{WWW}&      \textsc{www}    \\
%       \Lcs{VAXTAP}&   \textsc{vaxtap} \\
%       \Lcs{ZEBRA}&    \textsc{zebra}  \\
%    \end{tabular}
%    \caption{Shorthand macroes}
%  \end{table}
%
% \DescribeMacro{\bs}\DescribeMacro{\Lcs}
% Also defined are the macroes \Lcs{bs} and \Lcs{Lcs}.
% type, preceded by a backslash. \Lcs{bs} takes no argument, and produce 
% a backslash \bs{}. \Lcs{Lcs} takes one argument, and typesets this 
% argument in typewriter font, preceded by a backslash. This is usefull
% for macro descriptions etc. In fact \Lcs{Lcs} is produced by the 
% sequence \bs\texttt{Lcs\{Lcs\}}. These commands where actaully defined
% to ease the writing of this documentation, but left in the style, since
% I find them generally usefull. 
% 
% \iffalse
%<*package>
% \fi
%
% \section{Implementation}
% 
% In this section, the implementation of the \texttt{pawpict} package 
% will be described.
%
% \subsection{Style definitions}
%
% These definitions serve basically to say something about the style
% and not much else.
%
%    \begin{macrocode} 
\def\fileversion{v1.0} 
\def\filedate{97/12/12}
\def\docdate {97/12/12}
\ProvidesPackage{pawpict}[\filedate\space\fileversion\space pawpict
                          package.]
\NeedsTeXFormat{LaTeX2e}
\def\bs{{\tt\char'134}}
\newcommand{\Lcs}[1]{{\bs\tt#1}}
%    \end{macrocode}
%
% \subsection{Options}
%
% \DescribeOption{noborder}
% \DescribeOption{border}
% The Following is the avaliable options to the \texttt{pawpict}
% package.
%    \begin{macrocode}
\DeclareOption{border}{}
\DeclareOption{noborder}{\def\noborder{}}
\DeclareOption*{\PackageWarning{pawpict}{Unkown option: `\CurrentOption'}} 
\ProcessOptions\relax
%    \end{macrocode}
% Pass the option \texttt{noborder} to pawpict, if you in \PAW{} have
% created the pictures without borders. Else do nothing.
%
% \subsection{Control Commands}
%
% \begin{macro}{\pawdraft}
% This command controls wether \LaTeX{} should draw the picture, 
% or a box, the size of the picture.
%    \begin{macrocode}
\def\pawdraft{\def\higzdraft{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pawfigplacement}
% This command tells \LaTeX{} how to place the figures, using normal
% \LaTeX{} placement syntax. It defaults to \texttt{htbp}.
%    \begin{macrocode}
\newcommand{\pawfigplacement}[1]{\def\tempa{#1}}
\ifx\tempa\undefined
  \def\figplacement{htbp}
\else
  \def\figplacement{\tempa{}}
\fi
%    \end{macrocode}
% \end{macro}
%
% \subsection{The enviroments}
%
% Next the environments are defined. 
%
% \paragraph*{Notice:} No definitions are 
% present in the environment definitions. This is not possible because
% of the way \TeX{} interpreds argumments. It would have been nice to 
% limit the use of the definitions to the enviroments, but I just don't
% know a way to do that. The reason why \TeX{} will not allow it, is
% because \TeX{} expands the possible arguments of an environment, in 
% \emph{all} subseguent uses of that argument, also in macro definitions.
% So if you have an enviroment that takes an argument, then \emph{every}
% occurence of \texttt{\#1}\footnote{\texttt{\#1} is the \textit{token} 
% \TeX{} uses for the \textit{type}: ``\textit{the first argument of a
% macro}''.} is concidered an argument to the environment. That means, 
% if you have a macro definition in the definition of the environment
% of the form \Lcs{def}\Lcs{foo\#1\{...\#1...\}}, then, the argument
% the user  gave to the environment, will be passed to the macro,
% which doesn't make sense, because you will create a new macro every
% time you use  the enviroment. For exapmle, if you gave the
% environment the argument `\texttt{foo}', then the above macro would
% be \Lcs{foobar\{...\#1...\}} wich is strictly forbidden. 
% 
% \begin{macro}{pawpict}
% This is the simple enviroment, that takes no arguments, and merely 
% provide the neccesary dimensions.
%    \begin{macrocode}
\newenvironment{pawpict}[1][\textwidth]{
  \ifx\higzunit\undefined
    \newdimen\higzunit
  \fi
  \higzunit#1
%    \end{macrocode}
% Test to see if dimension \Lcs{higzunit} is defined, then define
%  it. In any case, set it to the (optional) argument of
% \texttt{pawpict} which defaults to width of page
%    \begin{macrocode}
  \ifx\noborder\undefined
    \divide\higzunit2268
   \else
     \divide\higzunit2045
   \fi
   \unitlength\higzunit
%    \end{macrocode}
% First we check to see, if the dimension \Lcs{higzunit} is set. This
% should be set by \HIGZ{}, when it writes out the \LaTeX{} file, or 
% by some other style (maybe \texttt{cernman}?). If it isn't set, then 
% it becomes the size of the text width. In any case
% the unit lenght (\Lcs{unitlenght}) becomes one $2000^\mbox{\small th}{}$ or
% one $2268^\mbox{\small th}{}$ part of  \Lcs{higzwidth} depending on wether
% the picture was created with a border or not. \Lcs{textwidth} is
% usally defined in either a  class (such as \texttt{article}) or a
% style (such as \texttt{a4wide}). This is done to make the picture
% come out right relative to the text.
%    \begin{macrocode}
  \ifx\higzdraft\undefined
  \else
    \begin{picture}(2000,2000)
      \put(0,0){\framebox(2000,2000){}}
      \put(500,500){\mbox{Here will be a picture made by \PAW{}}}
    \end{picture}
    \unitlength=0pt{}
  \fi
%    \end{macrocode}
% This is a check to see, if the picture should be draw. This is 
% usefull if you don't want \LaTeX{} to produce the final picture, for
% example if you are preparing a draft of your document, and only want
% to see if the picture has the right  size, and comes out the right 
% place. If \Lcs{higzdraft} is set, then \LaTeX will only produce a
% frame in the size of the right size. You can control this by the 
% command \Lcs{pawdraft}.
%    \begin{macrocode}
  \ifx\higzstep\undefined
    \newcount\higzstep\higzstep=0{}
  \fi
  \ifnum\higzstep<1
    \higzstep=2
  \fi
%    \end{macrocode}
% The dimension \Lcs{higzstep} determinds in how many steps, a curve,
% line, etc should be drawn. The should \emph{not} be extarnally 
% defined, unless in some very rare cases.
%    \begin{macrocode}
  \ifx\higzxx\undefined
    \newcount\higzxx
    \newcount\higzyy
    \newcount\higzx
    \newcount\higzy
    \newcount\higzdx
    \newcount\higzdy
    \newcount\higzlx
    \newcount\higzly
    \newcount\higzslope
    \newcount\higzlen
    \newcount\higzllen
    \newcount\higzoffs
    \newcount\higzloffs
    \newcount\higzadash
    \newcount\higzbdash
    \newcount\higzcdash
    \newcount\higzddash
    \newcount\higzmsize
    \newcount\higztemp
  \fi
%    \end{macrocode}
% Define all the counters needed to draw the pictures, if they are 
% not defined\footnote{Actually, they should not be defined any where
% else, then via the \texttt{pawpict} environment.}
%    \begin{macrocode}  
  \par
  \noindent
  \ifx\noborder\undefined
    \begin{picture}(2268,2268)(0,0)
  \else
    \begin{picture}(2000,2000)(0,0)
  \fi
}
{
  \end{picture}
}
%    \end{macrocode}
% Finally, start a \texttt{picture} environment, to put the drawing 
% macroes inside. 
% \end{macro}
% 
% \begin{macro}{pawfig}
% This is the more complex environment, with one mandatory and one
% optional argument. It is set in a \texttt{floatingfigure} or 
% in a \texttt{figure} environment, depending on wether the 
% \texttt{floatflt} style is avaliable.
%
% By default the figures are treated as normal floats, but if the
% \texttt{floatflt} style is avaliable, it makes a nicer output, to
% use this package for floats (i.e.\ for figures)
% So that {\sf pawpict} can be run independently of {\tt floatflt.sty}
% we first check for its existence and set the "have@floatflt" flag
% appropriately for use below.
%    \begin{macrocode}
\newif\ifhave@floatflt
\openin\@ne floatflt.sty
\ifeof\@ne \else \have@floatflttrue \fi
\closein\@ne \relax
%    \end{macrocode}
% If we found {\tt floatflt.sty} we use it.  
%    \begin{macrocode}
\ifhave@floatflt 
  \RequirePackage{floatflt} 
\fi
%    \end{macrocode}
% Now the conditinal definition of the \texttt{pawfig} environment
%    \begin{macrocode}
\newsavebox{\pawfigcaption}
%    \end{macrocode}
% Savebox for the caption of the figure.
%    \begin{macrocode}
\ifhave@floatflt
  \newenvironment{pawfig}[2][\textwidth]{
    \savebox{\pawfigcaption}{#2}
%    \end{macrocode}
% Save the second (mandatory) argument in the save box for the
% caption.
%    \begin{macrocode} 
    \ifx\pawfigwidth\undefined
      \newdimen\pawfigwidth
    \fi
    \pawfigwidth#1
    \ifdim\pawfigwidth>\textwidth
      \pawfigwidth\textwidth
    \fi
%    \end{macrocode}
% Define the dimension \Lcs{pawfigwidth}, and set it to the first
% (optional) argument. Then test to see if this is bigger then the
% dimension \Lcs{textwidth}, if it is, then set it to that
% dimension.
%    \begin{macrocode} 
    \begin{floatingfigure}{\pawfigwidth}
      \begin{pawpict}[\pawfigwidth]
  }
  {
      \end{pawpict}
      \caption{\usebox{\pawfigcaption}}
    \end{floatingfigure}
  }
%    \end{macrocode}
% Using the \texttt{floatingfigure} environment, we make a figure in
% the width of the text, if no optional argument is given, and then 
% start the primitive \texttt{pawpict} environment. Finally the 
% caption is put under the figure. 
%    \begin{macrocode}
\else
  \newenvironment{pawfig}[2][\textwidth]{
    \savebox{\pawfigcaption}{#2}
    \ifx\pawfigwidth\undefined
      \newdimen\pawfigwidth
    \fi
    \pawfigwidth#1
    \begin{figure}[\figplacement]    
      \begin{pawpict}[\pawfigwidth]
  }
  {
      \end{pawpict}
      \caption{\usebox{\pawfigcaption}}
    \end{figure}
  }
\fi
%    \end{macrocode}
% End of the conditional definition of \texttt{pawfig} environmanent.
% \end{macro}
%
% \begin{macro}{pawfigure}
% This is a simple environment, that takes two mandatory arguments:
% the width and the caption. Optional argument is the placement.  
%    \begin{macrocode}
\newenvironment{pawfigure}[3][htbp]{%
  \savebox{\pawfigcaption}{#3}
  \ifx\pawfigwidth\undefined
      \newdimen\pawfigwidth
  \fi
  \pawfigwidth#2
  \begin{figure}[#1]    
    \begin{pawpict}[\pawfigwidth]
}
{
    \end{pawpict}
    \caption{\usebox{\pawfigcaption}}
  \end{figure}
}
%    \end{macrocode}
% \end{macro}
%  
% \subsection{Picture include commands}
%
% \begin{macro}{\pawincludepict}
% This macro includes a file, putting it in a \texttt{pawpict}
% environment. The mandaory argument is the filename, the optional is
% the width of the picture.
%    \begin{macrocode}
\newcommand{\pawincludepict}[2][\textwidth]{%
  \begin{pawpict}%
     \input{#2}%
  \end{pawpict}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\pawincludefig}
% Much like above, only it is put in a \texttt{pawfig} environment,
% with to mandatory arguments, the filename, and the
% caption. Optionally the width of the figure may be specified.
%    \begin{macrocode}
\newcommand{\pawincludefig}[3][\textwidth]{%
  \begin{pawfig}[#1]{#3}%
    \input{#2} %
  \end{pawfig}%
}
%    \end{macrocode}
% \end{macro} 
% \begin{macro}{\pawincludefigure}
% Much like above, only it is put in a \texttt{pawfigure} environment,
% with three mandatory arguments, the filename, the width, and the
% caption. Optionally the placement of the figure may be specified.
%    \begin{macrocode}
\newcommand{\pawincludefigure}[4][htbp]{%
  \begin{pawfigure}[#1]{#3}{#4}%
    \input{#2} %
  \end{pawfigure}%
}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{The Drawing macroes}
%
% These macroes are not well documentated, I'm sorry \verb+:-(+.
%
% All the lines, curves, characters, etc.\ made by \HIGZ{} is made of 
% horizontal and vertical lines, or dots.
%
% In time, these maybe substuted with more efficient macros. Since the
% number of command needed to draw a picture is large, it takes some
% time to process the picture.
%
% \begin{macro}{\higzstroke}
% This defines the basic stroke of \HIGZ{}, an either vertical or 
% horizontal line.
%    \begin{macrocode}
\def\higzstroke#1,#2,#3,#4;{
  \advance\higzloffs\higzllen
  \ifnum\higzloffs>#1
    \advance\higzloffs-\higzllen
    \advance\higzloffs-#1
    \higzloffs=-\higzloffs
    \ifnum#2>0
      \put(\higzlx,\higzly){\line(#3,#4){\higzloffs}}
    \fi
    \ifnum#2<0
      \put(\higzlx,\higzly){\circle*{0}}
    \fi
    \higztemp=\higzloffs
    \multiply\higztemp#3
    \advance\higzlx\higztemp
    \higztemp=\higzloffs
    \multiply\higztemp#4
    \advance\higzly\higztemp
    \advance\higzllen-\higzloffs
    \higzloffs=#1
  \else
    \ifnum#2>0
      \put(\higzlx,\higzly){\line(#3,#4){\higzllen}}
    \fi
    \ifnum#2<0
      \put(\higzlx,\higzly){\circle*{0}}
    \fi
    \higzllen=0
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzdased}
% Like above, only with spaces between the lines, to make dashed and
% punctured lines, curves etc. 
%    \begin{macrocode}
\def\higzdashed#1,#2,#3,#4,#5;{{
  \higzlx=#1
  \higzly=#2
  \higzllen=#5
  \higzloffs=\higzoffs
  \loop
  \ifnum\higzloffs<\higzadash
    \ifnum\higzadash>1
      \higzstroke\higzadash,1,#3,#4;
    \else
      \higzstroke\higzadash,-1,#3,#4;
    \fi
  \else
    \ifnum\higzloffs<\higzbdash
      \higzstroke
      \higzbdash,0,#3,#4;
    \else
      \ifnum\higzloffs<\higzcdash
        \higztemp=\higzcdash
        \advance\higztemp-\higzbdash
        \ifnum\higztemp>1
          \higzstroke\higzcdash,1,#3,#4;
        \else
          \higzstroke\higzcdash,-1,#3,#4;
        \fi
      \else
        \ifnum\higzloffs<\higzddash
          \higzstroke\higzddash,0,#3,#4;
        \else
          \higzloffs=0
        \fi
      \fi
    \fi
  \fi
  \ifnum\higzllen>0
  \repeat
  \global\higzoffs=\higzloffs
}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzsolid}
% This macro draws a solid line!
%    \begin{macrocode}
\def\higzsolid#1,#2,#3,#4,#5;{
  \put(#1,#2){\line(#3,#4){#5}}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzhslant}
% This macro draws a slanted line made from small horizontal lines.
%    \begin{macrocode}
\def\higzhslant#1,#2,#3;{
  \higzslope=#1
  \multiply\higzslope1000
  \advance\higzslope500
  \divide\higzslope#2
  \higzlen=\higzslope
  \multiply\higzlen\higzstep
  \divide\higzlen1000
  \higzdy=0
  \loop
  \ifnum\higzdy<#2
    \higzx=\higzxx
    \higzy=\higzyy
    \higzdx=\higzslope
    \multiply\higzdx\higzdy
    \advance\higzdx500
    \divide\higzdx1000
    \advance\higzy\higzdy
    \multiply\higzdx#3
    \advance\higzx\higzdx
    \multiply\higzdx#3
    \advance\higzdx\higzlen
    \ifnum\higzdx>#1
      \advance\higzlen#1
      \advance\higzlen-\higzdx
    \fi
    \higzline\higzx,\higzy,#3,0,\higzlen;
    \advance\higzdy\higzstep
  \repeat
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzvslant}
% This macro draws a slanted line made from small vertical lines.
%    \begin{macrocode}
\def\higzvslant#1,#2,#3;{
  \higzslope=#2
  \multiply\higzslope1000
  \advance\higzslope500
  \divide\higzslope#1
  \higzlen=\higzslope
  \multiply\higzlen\higzstep
  \divide\higzlen1000
  \higzdx=0
  \loop
  \ifnum\higzdx<#1
    \higzx=\higzxx
    \higzy=\higzyy
    \higzdy=\higzslope
    \multiply\higzdy\higzdx
    \advance\higzdy500
    \divide\higzdy1000
    \advance\higzx\higzdx
    \multiply\higzdy#3
    \advance\higzy\higzdy
    \multiply\higzdy#3
    \advance\higzdy\higzlen
    \ifnum\higzdy>#2
      \advance\higzlen#2
      \advance\higzlen-\higzdy
    \fi
    \higzline\higzx,\higzy,0,#3,\higzlen;
    \advance\higzdx\higzstep
  \repeat
 }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\s}
% Draws a slanted line. This calls either \Lcs{higzhslant} or 
% \Lcs{higzvslant} depending on the slope of the line.
%    \begin{macrocode}
\def\s#1,#2;{
  \higzdx=#1{}
  \ifnum\higzdx<0
    \higzdx=-\higzdx
  \fi
  \higzdy=#2{}
  \ifnum\higzdy<0
    \higzdy=-\higzdy
  \fi
  \ifnum\higzdx<\higzdy
    \ifnum#1<0
      \advance\higzxx#1
      \advance\higzyy#2
      \ifnum#2<0
        \higzvslant-#1,-#2,1;
      \else
        \higzvslant-#1,#2,-1;
      \fi
    \else
      \ifnum#2<0
        \higzvslant#1,-#2,-1;
      \else
        \higzvslant#1,#2,1;
      \fi
      \advance\higzxx#1
      \advance\higzyy#2
    \fi
  \else
    \ifnum#2<0
      \advance\higzxx#1
      \advance\higzyy#2
      \ifnum#1<0
        \higzhslant-#1,-#2,1;
      \else
        \higzhslant#1,-#2,-1;
      \fi
    \else
      \ifnum#1<0
        \higzhslant-#1,#2,-1;
      \else
        \higzhslant#1,#2,1;
      \fi
      \advance\higzxx#1
      \advance\higzyy#2
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\h}
% Draws a horizontal line.
%    \begin{macrocode}
\def\h#1;{
  \higzline\higzxx,\higzyy,1,0,#1;
  \advance\higzxx#1
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\r}
% Draws a horizontal line (reversed).
%    \begin{macrocode}
\def\r#1;{
  \higzline\higzxx,\higzyy,-1,0,#1;
  \advance\higzxx-#1
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\U}
% Draw an upward line.
%    \begin{macrocode}
\def\U#1;{
  \higzline\higzxx,\higzyy,0,1,#1;
  \advance\higzyy#1
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\D}
% Draws a downward line.
%    \begin{macrocode}
\def\D#1;{
  \higzline\higzxx,\higzyy,0,-1,#1;
  \advance\higzyy-#1
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\m}
% Move to the point \texttt{(\#1,\#2)}.
%    \begin{macrocode}
\def\m#1,#2;{
  \higzxx=#1
  \higzyy=#2
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzdot}
% Draws a dot.
%    \begin{macrocode}
\def\higzdot#1,#2;{
  \put(#1,#2){\circle*{\higzmsize}}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzplus}
% A plus (+) sign.
%    \begin{macrocode}
\def\higzplus#1,#2;{
  \higzx=#1
  \multiply\higzx2
  \advance\higzx-\higzmsize
  \divide\higzx2
  \put(\higzx,#2){\line(1,0){\higzmsize}}
  \higzy=#2
  \multiply\higzy2
  \advance\higzy-\higzmsize
  \divide\higzy2
  \put(#1,\higzy){\line(0,1){\higzmsize}}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzstar}
% Draws a star (an ``x'' on top of a ``+'').
%    \begin{macrocode}
\def\higzstar#1,#2;{
  \higzplus#1,#2;\higzcross#1,#2;
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzcircle}
% A circle.
%    \begin{macrocode}
\def\higzcircle#1,#2;{
  \put(#1,#2){\circle{\higzmsize}}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\higzcross}
% Draws an ``x''
%    \begin{macrocode}
\def\higzcross#1,#2;{
  \let\higzsave\higzline
  \let\higzline\higzsolid
  \higzlx=#1
  \multiply\higzlx2
  \advance\higzlx-\higzmsize
  \divide\higzlx2\higzly=#2
  \multiply\higzly2
  \advance\higzly-\higzmsize
  \divide\higzly2
  \m\higzlx,\higzly;
  \s\higzmsize,\higzmsize;
  \higzly=#2
  \multiply\higzly2
  \advance\higzly\higzmsize
  \divide\higzly2
  \m\higzlx,\higzly;
  \s\higzmsize,-\higzmsize;
  \let\higzline\higzsave
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\p}
% Sets a point. \Lcs{higzmarker} is set by \HIGZ{}, to eihter 
% \Lcs{higzplus}, \Lcs{higzcross}, \Lcs{higzstar}, etc..
%    \begin{macrocode}
\def\p#1,#2;{
  \higzmarker#1,#2;
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\f}
% Draws a frame.
%    \begin{macrocode}
\def\f#1,#2;{
  \put(\higzxx,\higzyy){
    \makebox(#1,#2)[lb]{\rule{#1\unitlength}{#2\unitlength}}}
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Simple Text Producing Macroes}
%
%    \begin{macrocode}
\newcommand{\CERNLIB}{\textsc{cernlib}\index{CERNLIB}}
\newcommand{\CMZ}{\textsc{cmz}\index{CMZ}}
\newcommand{\COMIS}{\textsc{comis}\index{COMIS}}
\newcommand{\CSPACK}{\textsc{cspack}\index{CSPACK}}
\newcommand{\FATMEN}{\textsc{fatmen}\index{FATMEN}}
\newcommand{\GEANT}{\textsc{geant}\index{GEANT}}
\newcommand{\GKS}{\textsc{gks}\index{GKS}}
\newcommand{\HBOOK}{\textsc{hbook}\index{HBOOK}}
\newcommand{\HEPDB}{\textsc{hepdb}\index{HEPDB}}
\newcommand{\HIGZ}{\textsc{higz}\index{HIGZ}}
\newcommand{\HPLOT}{\textsc{hplot}\index{HPLOT}}
\newcommand{\KUIP}{\textsc{kuip}\index{KUIP}}
\newcommand{\MINUIT}{\textsc{minuit}\index{MINUIT}}
\newcommand{\PATCHY}{\textsc{patchy}\index{PATCHY}}
\newcommand{\PAW}{\textsc{paw}\index{PAW}}
\newcommand{\SIGMA}{\textsc{sigma}\index{SIGMA}}
\newcommand{\PAWPP}{\textsc{paw++}\index{PAW++}}
\newcommand{\WWW}{\textsc{www}\index{WWW}}
\newcommand{\VAXTAP}{\textsc{vaxtap}\index{VAXTAP}}
\newcommand{\ZEBRA}{\textsc{zebra}\index{ZEBRA}}
%    \end{macrocode}
% \iffalse
%</package>
% \fi
%
% \Finale
% \PrintIndex \PrintChanges
\endinput