(**********************************************************************
Received: from DGOGWDG1 by DGOGWDG1.BITNET (Mailer R2.07) with BSMTP id 6886;
Fri, 26 Jul 91 19:02:21 MSZ
Received: from mars.gwdg.de by ibm.gwdg.de (IBM VM SMTP R1.2.2MX) with TCP; Fri,
26 Jul 91 19:02:17 MSZ
Received: by mars.gwdg.de (5.51.2/Apollo-Domain/OS-SR10.1)
       id AA05383; Fri, 26 Jul 91 19:02:39 +0100
Date: Fri, 26 Jul 91 19:02:39 +0100
From: [email protected] (Martin Frerichs)
Message-Id: <[email protected]>
To: [email protected]
***********************************************************************)
PROGRAM PicTeX;

Label 9999;

CONST Debug = False;

TYPE styp = (right,left);
    byte = 0..255;
    var_string = varying[256] of char;

VAR aus                                                             : text;
   ausn,oben,unten,rechts,links,eingabe,ausgabe,
   savename,savekomm,unterschrift,labelstr,ueberschrift            :
var_string;
   unitx,unity, xmax,xmin,ymax,ymin,dx,dy,dxsub,dysub,breite,hoehe,
   unitry,rymin,rymax,rdy,rdysub                                   : real;
   fertig,rechteachse,xlog,ylog,rylog,xkreuz,ykreuz,rykreuz        : boolean;
   replot,finalplot                                                : boolean;
   ydez,xdez,rydez                                                 : byte;
   ch,sprache                                                      : char;
   seite                                                           : styp;

PROCEDURE read_value_eof(VAR datei : text; VAR wert : real; VAR Ende : boolean);
BEGIN
 Ende := eof(datei);
 IF not Ende THEN
   BEGIN
     read(datei,wert);
     Ende := eof(datei);
   END;
 END;

(****************************************************************************)
(* Zehner-Logarithmus von 'x':                                              *)

FUNCTION lg(x: real): real;

CONST rez_ln_10 = 0.4342944819;             (* rez_ln_10 = 1 / ln(10) *)

BEGIN
 lg :=0;
 IF x > 0.0 THEN
   lg := Ln(x) * rez_ln_10
 ELSE
   writeln('Argumentfehler: lg(x): x <= 0 !!!')
END;

(****************************************************************************)
(* Berechnung von 'x hoch y':                                               *)

FUNCTION x_hoch_y (x, y: real): real;

VAR ganz_y: InTEGER;

BEGIN
 IF (x <> 0.0) OR (y <> 0.0) THEN
   IF x > 0.0 THEN
     x_hoch_y := Exp(y * Ln(x))
   ELSE
     BEGIN
       ganz_y := Trunc(y);
       IF ABS(y) <> ABS(ganz_y) THEN
         writeln('x_hoch_y(x,y): nur ganzzahlige Exponenten zulaessig bei x<0')
       ELSE
         IF x <> 0.0 THEN
           IF (ganz_y MOD 2) = 0 THEN
             x_hoch_y :=  Exp(Ln(ABS(x)) * y)
           ELSE
             x_hoch_y := -Exp(Ln(ABS(x)) * y)       (* ungerader Exponent *)
         ELSE
           x_hoch_y := 0
     END
 ELSE
   writeln('x_hoch_y(x,y): x = 0 und y = 0')
END;

(****************************************************************************)


(****************************************************************************)
PROCEDURE process_file(seite : styp;
                      VAR fertig : boolean;
                      rechteachse,xlogar,ylogar : boolean;
                      VAR aus : text);

CONST b1='BEGIN';
     e1='END';

VAR einn,symbol,test : var_string;
   symbolcount,cur  : integer;
   ein              : text;
   anzahl           : integer32;
   ch               : char;
   sym,linie,quadratic,clipping,Ende : boolean;
   x,y,xa,ya        : real;

 FUNCTION betest(t,v : var_string): boolean;
 VAR t1 : var_string;
      i : byte;
 BEGIN
   t1.length := 0;
   FOR i:=1 TO t.length DO
     IF t.body[i] <> ' ' THEN
       BEGIN
         t1.body[i]:= t.body[i];
         t1.length := t1.length + 1
       END;
   IF t1 = v THEN
     betest := true
   ELSE
     betest :=false
 END;

BEGIN {of process_file}
 writeln('Ende durch leere Eingabe !!');
 REPEAT
   write('Daten -Datei (TechPlot-Format!!) : ');
   readln(einn);
   IF einn='' THEN
     fertig := true
   ELSE
     fertig := false;
   IF not fertig THEN
     BEGIN
       anzahl := 0;
       open(ein,einn,'OLD');
       REPEAT
         write('mit Plotsymbol      (j/n) ? ');
         readln(ch);
       UNTIL ((ch='j') or (ch='n'));
       IF ch='j' THEN
         sym := true
       ELSE
         sym := false;
       REPEAT
         write('durchgezogene Linie (j/n) ? ');
         readln(ch);
       UNTIL ((ch='j') or (ch='n'));
       IF ch='j' THEN
         linie := true
       ELSE
         linie := false;
       IF linie THEN
         BEGIN
           REPEAT
             write('Quadratische Interpolation (1) oder Polygonzug (2) ? ');
             readln(ch);
           UNTIL ((ch='1') or (ch='2'));
           IF ch='1' THEN
             quadratic := true
           ELSE
             quadratic := false;
           REPEAT
             write('Clipping noetig (Achtung, das dauert lange) (j/n) ? ');
             readln(ch);
           UNTIL ((ch='j') or (ch='n'));
           IF ch='j' THEN
             clipping := true
           ELSE
             clipping := false;
         END;
       IF sym THEN
         BEGIN
           write('Plotsymbol (LaTeX-Text) : ');
           readln(symbol);
           REPEAT
             write('Plotsymbol jeden n-ten Punkt : n = ');
             readln(symbolcount)
           UNTIL symbolcount > 0;
           reset(ein);
           writeln(aus,'%Datei ',einn,' (Symbole)');
           REPEAT
             readln(ein,test);
             writeln(aus,'%% ',test);
           UNTIL ((betest(test,b1)) or eof(ein));
           Ende := false;
           IF eof(ein) THEN
             Ende := true;
             write(aus,'% Daten fuer ');
             IF rechteachse THEN
               IF (seite=left) THEN
                 write(aus,'linke ')
               ELSE
                 write (aus,'rechte ');
             writeln(aus,'y-Achse ...');
             IF NOT Ende THEN
               BEGIN
                 writeln('\multiput {',symbol,'} at ');
                 writeln(aus,'\multiput {',symbol,'} at  %');
               END;
             cur := 0;
             WHILE NOT Ende DO
               BEGIN
                 read_value_eof(ein,x,Ende);
                 read_value_eof(ein,y,Ende);
                 IF NOT Ende THEN
                   BEGIN
                     readln(ein);
                     anzahl := anzahl + 1;
                     cur    := cur + 1;
                     IF xlogar THEN
                       x:=lg(x);
                     IF ylogar THEN
                       y:=lg(y);
                     IF (cur MOD symbolcount) = 0 THEN
                       BEGIN
                         writeln(aus,'  ',x:8:6,' ',y:8:6,' %');
                         writeln(         x:8:5,' ',y:8:4)
                       END
                   END
                 ELSE
                   BEGIN
                     writeln(' /');
                     writeln(aus,' /');
                   END;
               END;
         END;
       IF linie THEN
         BEGIN
           reset(ein);
           anzahl := 0;
           writeln(aus,'%Datei ',einn,' (Linie)');
           REPEAT
             readln(ein,test);
             writeln(aus,'%% ',test);
           UNTIL ((betest(test,b1)) or eof(ein));
           Ende := false;
           IF eof(ein) THEN
             Ende := true;
           IF replot THEN
             BEGIN
               writeln(aus,'\ifreplot');
               writeln(aus,'\else')
             END;
           IF clipping THEN
             writeln(aus,'\inboundscheckon');
           IF quadratic THEN
             writeln(aus,'\setquadratic')
           ELSE
             writeln(aus,'\setlinear');
           writeln(aus,'\plot ');
           WHILE NOT Ende DO
             BEGIN
               read_value_eof(ein,x,Ende);
               read_value_eof(ein,y,Ende);
               IF not Ende THEN
                 BEGIN
                   readln(ein);
                   anzahl := anzahl + 1;
                   IF xlogar THEN
                     x:=lg(x);
                   IF ylogar THEN
                     y:=lg(y);
                   xa :=x;
                   ya :=y;
                   writeln(aus,'  ',x:8:6,' ',y:8:6,' %');
                   writeln(         x:8:4,' ',y:8:4);
                 END;
             END;
           IF quadratic THEN
             IF not odd(anzahl) THEN
               writeln(aus,'  ',xa*1.00001:8:6,' ',ya*1.00001:8:6,' %');
           writeln(aus,'/');
           IF clipping THEN
             writeln(aus,'\inboundscheckoff');
           IF replot THEN
             writeln(aus,'\fi')
         END;
       close(ein);
     END
 UNTIL fertig
END; {of process_file}

PROCEDURE Einheiten(VAR unitx,unity,unitry : real; breite,hoehe : real;
                   rechteachse,xlog,ylog,rylog : boolean);
BEGIN
 IF xlog THEN
   unitx := breite/(lg(xmax)-lg(xmin))
 ELSE
   unitx := breite/(xmax-xmin);
 IF ylog THEN
   unity := HOEHE/(lg(ymax)-lg(ymin))
 ELSE
   unity := hoehe/(ymax-ymin);
 IF rechteachse THEN
   IF rylog THEN
     unitry := hoehe/(lg(rymax)-lg(rymin))
   ELSE
     unitry := hoehe/(rymax-rymin)
 ELSE unitry :=0;
END;

PROCEDURE Skala (VAR aus : text; seite : styp; unitx,unity : real;
                xlog,ylog,rechteachse,xkreuz,ykreuz : boolean;
                xmin,xmax,dx,dxsub,ymin,ymax,dy,dysub : real;
                xdez,ydez :byte; unten,oben,rechts,links : var_string);
VAR con: text;

 PROCEDURE Log_schrift(VAR aus: text; min,max : real;
                       markiere,kreuz : boolean);
 VAR ort,o2    : real;
     expo,code : integer;
     stellen,i : byte;
     ex        : var_string;
 BEGIN
   IF Debug THEN
     BEGIN
       writeln;
       writeln('Log_Schrift: Parameter');
       writeln('Minimum : ',min );
       writeln('Maximum : ',max )
     END;
   writeln(aus,' ticks logged  ');
   IF kreuz THEN
     write(aus,'andacross ');
   IF markiere THEN
     writeln(aus,'numbered ')
   ELSE
     writeln(aus,'unlabeled ');
   IF markiere THEN
     BEGIN        {Zahlen dranschreiben}
       write(aus,'withvalues ');
       ort  := min/10.0;
       expo := Round(lg(ort));
       REPEAT
         o2 := (x_hoch_y(10,expo));
         IF ((o2>=min) and (o2<=max)) THEN
           write(aus,'$10^{',expo:1,'}$ ');
         ort := 2.0*o2;
         IF ((ort<=max) and (ort>=min)) THEN
           write(aus,'2 ');
         ort := 3.0*o2;
         IF ((ort>=min) and (ort<=max)) THEN
           write(aus,'3 ');
         ort := 5.0*o2;
         IF ((ort>=min) and (ort<=max)) THEN
           write(aus,'5 ');
         expo := expo + 1
       UNTIL ort>max;
       writeln(aus,' /');
     END;
   {ticks setzen, normal lang}
   write(aus,' at ');
   ort  := min/10.0;
   expo := Round(lg(ort));
   REPEAT
     o2 := (x_hoch_y(10,expo));
     IF expo<0 THEN
       stellen := abs(expo)
     ELSE
       stellen := 0;
     IF ((o2>=min) and (o2<=max)) THEN
       write(aus,x_hoch_y(10,expo):1:stellen,' ');
     {o2 := ort;}
     ort := 2.0*o2;
     IF ((ort<=max) and (ort>=min)) THEN
       write(aus,ort:1:stellen,' ');
     ort := 3.0*o2;
     IF ((ort>=min) and (ort<=max)) THEN
       write(aus,ort:1:stellen,' ');
     ort := 5.0*o2;
     IF ((ort>=min) and (ort<=max)) THEN
       write(aus,ort:1:stellen,' ');
     expo := expo + 1
   UNTIL ort>max;
   writeln(aus,' /');
   {ticks, immer ohne Beschriftung, lang }
   writeln(aus,' unlabeled at ');
   ort := min/10.0;
   expo := Round(lg(ort));
   REPEAT
     o2 := (x_hoch_y(10,expo));
     IF expo<0 THEN
       stellen := abs(expo)
     ELSE
       stellen :=0;
     ort := 4.0*o2;
     IF ((ort>=min) and (ort<=max)) THEN
       write(aus,ort:1:stellen,' ');
     FOR i:=6 TO 9 DO
       BEGIN
         ort := i*o2;
         IF ((ort>=min) and (ort<=max)) THEN
           write(aus,ort:1:stellen,' ');
       END;
     expo := expo + 1
   UNTIL ort>max;
   writeln(aus,' /');
   {ticks, ohne Beschriftung, kurz }
   writeln(aus,' unlabeled short at ');
   ort := min/10.0;
   expo := Round(lg(ort));
   REPEAT
     o2 := (x_hoch_y(10,expo));
     IF expo<=0 THEN
       stellen := abs(expo)+1
     ELSE
       stellen :=0;
     FOR i:=1 TO 9 DO
       BEGIN
         ort := o2*(1.0+i*0.2);       {1.2, 1.4, ... 2.8 }
         IF ((ort>=min) and (ort<=max)) THEN
           write(aus,ort:1:stellen,' ');
       END;
     ort :=3.5*o2;
     IF ((ort>=min) and (ort<=max)) THEN
       write(aus,ort:1:stellen,' ');
     ort :=4.5*o2;
     IF ((ort>=min) and (ort<=max)) THEN
       write(aus,ort:1:stellen,' ');
     expo := expo + 1
   UNTIL ort>max;
   writeln(aus,' /');  {letztes "at"}
   writeln(aus,' /');  {Ende von "\axis"}
 END; { of Log_Schrift}

BEGIN { of Skala}
 open(con,'-STDOUT','UNKNOWN');
 rewrite(con);
 write('\setcoordinatesystem units <',unitx:1:5,'mm,',unity:1:5,'mm> point at
');
 IF xlog THEN
   write(lg(xmin):1:5,' ')
 ELSE
   write(xmin:1:5,' ');
 IF ylog THEN
   writeln(lg(ymin):1:5)
 ELSE
   writeln(ymin:1:5);
 write('\setplotarea x from ');
 IF xlog THEN
   write(lg(xmin):8:5)
 ELSE
   write(xmin:8:5);
 write(' to ');
 IF xlog THEN
   write(lg(xmax):8:5)
 ELSE
   write(xmax:8:5);
 write(', y from ');
 IF ylog THEN
   write(lg(ymin):8:5)
 ELSE
   write(ymin:8:5);
 write(' to ');
 IF ylog THEN
   writeln(lg(ymax):8:5)
 ELSE
   writeln(ymax:8:5);
 IF seite=left THEN
   BEGIN
     write('\axis bottom shiftedto y=');
     IF ylog THEN
       write(lg(ymin):8:5)
     ELSE
       write(ymin:8:5);
     write(' label {',unten,'} ');
     IF xlog THEN
       Log_schrift(con,xmin,xmax,true,xkreuz)
     ELSE
       writeln(' ticks numbered  from ',
               xmin:8:xdez,' to ',xmax:8:xdez,' by ',dx:8:xdez,
               ' unlabeled short from ',xmin:8:xdez,' to ',
               xmax:8:xdez,' by ',dxsub:8:xdez,' /');
     IF oben <> '' THEN
       BEGIN
         write('\axis top    shiftedto y=');
         IF ylog THEN
           write(lg(ymax):8:5)
         ELSE
           write(ymax:8:5);
         write(' label {',oben,'} ');
         IF xlog THEN
           Log_schrift(con,xmin,xmax,false,false)
         ELSE
           writeln(' ticks unlabeled  from ',
                   xmin:8:xdez,' to ',xmax:8:xdez,' by ',dx:8:xdez,
                   ' unlabeled short from ',xmin:8:xdez,' to ',
                   xmax:8:xdez,' by ',dxsub:8:xdez,' /')
       END;
     write('\axis left   shiftedto x=');
     IF xlog THEN
       write(lg(xmin):8:5)
     ELSE
       write(xmin:8:5);
     write(' label {',links,'} ');
     IF ylog THEN
       Log_schrift(con,ymin,ymax,true,ykreuz)
     ELSE
       writeln(' ticks numbered  from ',
               ymin:8:ydez,' to ',ymax:8:ydez,' by ',dy:8:ydez,
               ' unlabeled short from ',ymin:8:ydez,' to ',
               ymax:8:ydez,' by ',dysub:8:ydez,' /');
     IF not rechteachse THEN
       IF rechts <> '' THEN
         BEGIN
           write('\axis right  shiftedto x=');
           IF xlog THEN
             write(lg(xmax):8:5)
           ELSE
             write(xmax:8:5);
           write(' label {',rechts,'} ');
           IF ylog THEN
             Log_schrift(con,ymin,ymax,false,false)
           ELSE
             writeln(' ticks unlabeled  from ',
                     ymin:8:ydez,' to ',ymax:8:ydez,' by ',dy:8:ydez,
                     ' unlabeled short from ',ymin:8:ydez,' to ',
                     ymax:8:ydez,' by ',dysub:8:ydez,' /')
         END
   END
 ELSE
   BEGIN
     write('\axis right  shiftedto x=');
     IF xlog THEN
       write(lg(xmax):8:5)
     ELSE
       write(xmax:8:5);
     write(' label {',rechts,'} ');
     IF ylog THEN
       Log_schrift(con,ymin,ymax,true,ykreuz)
     ELSE
       writeln(' ticks numbered  from ',
               ymin:8:ydez,' to ',ymax:8:ydez,' by ',dy:8:ydez,
               ' unlabeled short from ',ymin:8:ydez,' to ',
               ymax:8:ydez,' by ',dysub:8:ydez,' /');
   END;
 close(con);
 write(aus,'\setcoordinatesystem units <',unitx:1:5,'mm,',unity:1:5,'mm> point
at ');
 IF xlog THEN
   write(aus,lg(xmin):1:6,' ')
 ELSE
   write(aus,xmin:1:6,' ');
 IF ylog THEN
   writeln(aus,lg(ymin):1:6)
 ELSE
   writeln(aus,ymin:1:6);
 write(aus,'\setplotarea x from ');
 IF xlog THEN
   write(aus,lg(xmin):1:6)
 ELSE
   write(aus,xmin:1:6);
 write(aus,' to ');
 IF xlog THEN
   write(aus,lg(xmax):1:6)
 ELSE
   write(aus,xmax:1:6);
 write(aus,', y from ');
 IF ylog THEN
   write(aus,lg(ymin):1:6)
 ELSE
   write(aus,ymin:8:5);
 write(aus,' to ');
 IF ylog THEN
   writeln(aus,lg(ymax):1:6)
 ELSE
   writeln(aus,ymax:1:6);
 IF seite=left THEN
   BEGIN
     write(aus,'\axis bottom shiftedto y=');
     IF ylog THEN
       write(aus,lg(ymin):1:6)
     ELSE
       write(aus,ymin:1:6);
     write(aus,' label {',unten,'} ');
     IF xlog THEN
       Log_schrift(aus,xmin,xmax,true,xkreuz)
     ELSE
       BEGIN
         write(aus,' ticks ');
         IF xkreuz THEN
           write(aus,'andacross ');
         writeln(aus,'numbered  from ',
                     xmin:1:xdez,' to ',xmax:1:xdez,' by ',dx:1:xdez,
                     ' unlabeled short from ',xmin:1:xdez+3,' to ',
                     xmax:1:xdez+3,' by ',dxsub:1:xdez+3,' /');
       END;
     IF oben <> '' THEN
       BEGIN
         write(aus,'\axis top    shiftedto y=');
         IF ylog THEN
           write(aus,lg(ymax):1:6)
         ELSE
           write(aus,ymax:1:6);
         write(aus,' label {',oben,'} ');
         IF xlog THEN
           Log_schrift(aus,xmin,xmax,false,false)
         ELSE
           writeln(aus,' ticks unlabeled  from ',
                      xmin:1:xdez+2,' to ',xmax:1:xdez+2,' by ',dx:1:xdez+2,
                      ' unlabeled short from ',xmin:1:xdez+3,' to ',
                      xmax:1:xdez+3,' by ',dxsub:1:xdez+3,' /')
       END;
     write(aus,'\axis left   shiftedto x=');
     IF xlog THEN
       write(aus,lg(xmin):1:6)
     ELSE
       write(aus,xmin:1:6);
     write(aus,' label {',links,'} ');
     IF ylog THEN
       Log_schrift(aus,ymin,ymax,true,ykreuz)
     ELSE
       BEGIN
         write(aus,' ticks ');
         IF ykreuz THEN
           write(aus,'andacross ');
         writeln(aus,'numbered  from ',
                     ymin:1:ydez,' to ',ymax:1:ydez,' by ',dy:1:ydez,
                     ' unlabeled short from ',ymin:1:ydez+3,' to ',
                     ymax:1:ydez+3,' by ',dysub:1:ydez+3,' /');
       END;
     IF not rechteachse THEN
       IF rechts <> '' THEN
         BEGIN
           write(aus,'\axis right  shiftedto x=');
           IF xlog THEN
             write(aus,lg(xmax):1:6)
           ELSE
             write(aus,xmax:1:6);
           write(aus,' label {',rechts,'} ');
           IF ylog THEN
             Log_schrift(aus,ymin,ymax,false,false)
           ELSE
             writeln(aus,' ticks unlabeled  from ',
                         ymin:1:ydez+2,' to ',ymax:1:ydez+2,' by ',dy:1:ydez+2,
                         ' unlabeled short from ',ymin:1:ydez+3,' to ',
                         ymax:1:ydez+3,' by ',dysub:1:ydez+3,' /')
         END
   END
 ELSE
   BEGIN
     write(aus,'\axis right  shiftedto x=');
     IF xlog THEN
       write(aus,lg(xmax):1:6)
     ELSE
       write(aus,xmax:1:6);
     write(aus,' label {',rechts,'} ');
     IF ylog THEN
       Log_schrift(aus,ymin,ymax,true,ykreuz)
     ELSE
       BEGIN
         write(aus,' ticks ');
         IF ykreuz THEN
           write(aus,'andacross ');
         writeln(aus,'numbered  from ',
                     ymin:1:ydez,' to ',ymax:1:ydez,' by ',dy:1:ydez,
                     ' unlabeled short from ',ymin:1:ydez+3,' to ',
                     ymax:1:ydez+3,' by ',dysub:1:ydez+3,' /');
       END;
   END;
END; {of Skala}

BEGIN
 writeln;
 writeln('          Datei-Konverter Daten -->PiCTeX input ...  ');
 writeln('(c) Christian Boettger, Inst. f. Metallphysik, TU Braunschweig');
 writeln(' &  Martin Frerichs, Inst. f. Theor. Physik, U Goettingen for');
 writeln('                     Revised Unix Edition');
 writeln('                Version 1.0.1, 26.7.1991 ');
 writeln;
 write('PiCTeX-Datei                     : ');
 readln(ausn);
 open(aus,ausn,'UNKNOWN');
 rewrite(aus);
 writeln;
 write('X-Achse : Minimum = ');
 readln(xmin);
 write('X-Achse : Maximum = ');
 readln(xmax);
 REPEAT
   write('x-Achse logarithmisch (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   xlog := true
 ELSE xlog := false;
 IF not xlog THEN
   BEGIN
     write('X-Achse : Schrittweite = ');
     readln(dx);
     write('X-Achse : Schrittweite Sub-Unterteilungen = ');
     readln(dxsub);
     write('X-Achse : Dezimalstellen der Beschriftung = ');
     readln(xdez);
   END;
 REPEAT
   write('x-Achse Markierungen durchziehen (Gitter) (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   xkreuz := true
 ELSE
   xkreuz := false;
 writeln;
 writeln('Eingabe der Daten fuer die (linke) Y-Achse ...');
 write('y-Achse : Minimum = ');
 readln(ymin);
 write('y-Achse : Maximum = ');
 readln(ymax);
 REPEAT
   write('(linke) y-Achse logarithmisch (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   ylog := true
 ELSE
   ylog := false;
 IF not ylog THEN
   BEGIN
     write('y-Achse : Schrittweite = ');
     readln(dy);
     write('y-Achse : Schrittweite Sub-Unterteilungen = ');
     readln(dysub);
     write('y-Achse : Dezimalstellen der Beschriftung = ');
     readln(ydez);
   END;
 REPEAT
   write('(linke) y-Achse Markierungen durchziehen (Gitter) (j/n) ? ');
   readln(ch);
 UNTIL ((ch='N') or (ch = 'n') or (ch = 'J') or (ch='j'));
 IF (ch='j') or (ch = 'j') THEN
   ykreuz := true
 ELSE
   ykreuz := false;
 writeln;
 REPEAT
   write('zweite unabhaengige Skala auf rechter y-Achse (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   rechteachse :=true
 ELSE
   rechteachse:=false;
 IF rechteachse THEN
   BEGIN
     writeln;
     write('rechte y-Achse : Minimum = ');
     readln(rymin);
     write('rechte y-Achse : Maximum = ');
     readln(rymax);
     REPEAT
       write('rechte y-Achse logarithmisch (j/n) ? ');
       readln(ch);
     UNTIL ((ch='n') or (ch='j'));
     IF ch='j' THEN
       rylog := true
     ELSE
       rylog := false;
     IF not rylog THEN
       BEGIN
         write('rechte y-Achse : Schrittweite = ');
         readln(rdy);
         write('rechte y-Achse : Schrittweite Sub-Unterteilungen = ');
         readln(rdysub);
         write('rechte y-Achse : Dezimalstellen der Beschriftung = ');
         readln(rydez);
       END;
     REPEAT
       write('rechte y-Achse Markierungen durchziehen (Gitter) (j/n) ? ');
       readln(ch);
     UNTIL ((ch='n') or (ch='j'));
     IF ch='j' THEN
       rykreuz := true
     ELSE
       rykreuz := false;
     writeln;
   END;
 write('Beschriftung Unterkante : ');
 readln(unten);
 write('Beschriftung Oberkante  : ');
 readln(oben);
 write('Beschriftung rechts     : ');
 readln(rechts);
 write('Beschriftung links      : ');
 readln(links);
 writeln;
 write('Breite des Bildes in mm = ');
 readln(breite);
 write('Hoehe  des Bildes in mm = ');
 readln(hoehe);
 writeln;
 write('Unterschrift des Bildes (\caption) : ');
 readln(unterschrift);
 write('Ueberschrift des Bildes            : ');
 readln(ueberschrift);
 write('LaTeX-Label des Bildes : ');readln(labelstr);
 REPEAT
   writeln('Sprache des Textes:');
   write(' a=austrian, e=english, f=french, g=german, u=USenglish ? ');
   readln(sprache);
 UNTIL sprache in ['a','e','f','g','u'];
 writeln;
 writeln('und nun die Zwischenspeicherung ...');
 savename :='';
 REPEAT
   write('Dateiname fuer \savelinesandcurves bzw. \replot = ');
   readln(savename);
 UNTIL savename<>'';
 write('Kommentar im Save-File = ');
 readln(savekomm);
 writeln;
 writeln('und nun die if-switches (Diese muessen im Dokument vor Benutzung');
 writeln('                         deklariert werden!)');
 REPEAT
   write('Switch replot benutzen (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   replot := true
 ELSE
   replot := false;
 writeln;
 REPEAT
   write('Switch finalplot benutzen (j/n) ? ');
   readln(ch);
 UNTIL ((ch='n') or (ch='j'));
 IF ch='j' THEN
   finalplot := true
 ELSE
   finalplot := false;
 writeln;
 Einheiten(unitx,unity,unitry,breite,hoehe,rechteachse,xlog,ylog,rylog);
 writeln('\begin{figure}[htb]');
 writeln('\originalTeX');
 writeln('\[ %horizontal zentrierte Ausgabe an');
 writeln('\beginpicture');
 writeln(aus,'\begin{figure}[htb]');
 writeln(aus,'\originalTeX');
 writeln(aus,'\[  %zentrierte Ausgabe an');
 writeln(aus,'\beginpicture');
 IF replot THEN
   BEGIN
     writeln(aus,'\ifreplot');
     writeln(aus,'\else');
   END;
 writeln(aus,'\savelinesandcurves on "',savename,'"');
 writeln(aus,'\writesavefile {',savekomm,'}');
 IF replot THEN
   writeln(aus,'\fi');
 skala (aus,left,
        unitx,unity,
        xlog,ylog,rechteachse,xkreuz,ykreuz,
        xmin,xmax,dx,dxsub,ymin,ymax,dy,dysub,xdez,ydez,
        unten,oben,rechts,links);
 IF ueberschrift <> '' THEN
   writeln(aus,'\plotheading {',ueberschrift,'}');
 IF replot THEN
   BEGIN
     writeln(aus,'\ifreplot');
     IF finalplot THEN
       writeln(aus,'\iffinalplot');
     writeln(aus,'\replot "',savename,'"');
     IF finalplot THEN
       writeln(aus,'\fi');
     writeln(aus,'\fi')
   END
 ELSE
   writeln(aus,'%\replot');
 fertig := false;
 IF finalplot THEN
   writeln(aus,'\iffinalplot');
 REPEAT
   writeln;
   IF rechteachse THEN
     writeln('nur Daten fuer die LINKE (!!) y- Achse jetzt !!!!');
   process_file(left,fertig,rechteachse,xlog,ylog,aus);
 UNTIL fertig;
 IF finalplot THEN
   writeln(aus,'\fi');
 IF rechteachse THEN
   BEGIN
     skala (aus,right,
            unitx,unitry,
            xlog,rylog,rechteachse,xkreuz,rykreuz,
            xmin,xmax,dx,dxsub,rymin,rymax,rdy,rdysub,xdez,rydez,
            unten,oben,rechts,links);
     fertig := false;
     IF finalplot THEN
       writeln(aus,'\iffinalplot');
     REPEAT
       writeln;
       writeln('nur Daten fuer die RECHTE (!!) y- Achse ab jetzt !!!!');
       process_file(right,fertig,rechteachse,xlog,rylog,aus);
     UNTIL fertig;
     IF finalplot THEN
       writeln(aus,'\fi');
   END;
 IF replot THEN
   BEGIN
     writeln(aus,'\ifreplot');
     writeln(aus,'\else')
   END;
 writeln(aus,'\dontsavelinesandcurves');
 IF replot THEN
   writeln(aus,'\fi');
 writeln(aus,'\endpicture');
 writeln(aus,'\]');
 writeln(aus,'\germanTeX');
 write(aus,'\selectlanguage{\');
 CASE sprache OF
   'a' : writeln(aus,'austrian}');
   'e' : writeln(aus,'english}');
   'f' : writeln(aus,'french}');
   'g' : writeln(aus,'german}');
   'u' : writeln(aus,'USenglish}');
 END;
 writeln(aus,'\caption{',unterschrift,' \label{',labelstr,'}}');
 writeln(aus,'\end{figure}');
 writeln('\endpicture');
 writeln('\]');
 writeln('\germanTeX');
 write('\selectlanguage{\');
 CASE sprache OF
   'a' : writeln('austrian}');
   'e' : writeln('english}');
   'f' : writeln('french}');
   'g' : writeln('german}');
   'u' : writeln('USenglish}');
 END;
 writeln('\caption{',unterschrift,' \label{',labelstr,'}}');
 writeln('\end{figure}');
 close(aus);
 9999:
END.