Index: Singular/LIB/latex.lib
===================================================================
--- Singular/LIB/latex.lib	(revision a5279cef2f7895ec8e67e6a1c0e9ee30da6f7511)
+++ Singular/LIB/latex.lib	(revision 651b4646ed535e81739179b38258acc14067c72b)
@@ -1,3 +1,3 @@
-// $Id: latex.lib,v 1.1 1998-05-17 17:39:51 obachman Exp $   
+// $Id: latex.lib,v 1.2 1998-05-20 15:40:07 gorzel Exp $   
 //                        1998/04/17
 // author : Christian Gorzel email: gorzelc@math.uni-muenster.de
@@ -5,5 +5,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 
-
+version="1.14";
+info="
 LIBRARY: latex.lib    PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN LATEX2E
                         by Christian Gorzel, send bugs and
@@ -32,22 +33,23 @@
 
   TeXwidth      : int: -1,0,1..9, >9  controls the breaking of long polynomials
-  TeXnofrac     : (int) flag,  write 1/2 instead of \\frac{1}{2}
-  TeXbrack      : string: possible values {,(,<,|, \"\"
+  TeXnofrac     : (int) flag,  write 1/2 instead of \frac{1}{2}
+  TeXbrack      : string: possible values {,(,<,|, the empty string
                           controls brackets around ideals and matrices
   TeXproj       : (int) flag, write : instead of , in intvecs and vectors
   TeXaligned    : (int) flag, write maps (and ideals) aligned
   TeXreplace    : list, entries twoelemented list for replacing symbols
-  NoDollars     : (int) flag, suppresses surrounding "$" signs
-
+  NoDollars     : (int) flag, suppresses surrounding $ signs
+";
 
 ///////////////////////////////////////////////////////////////////////////////
 
 proc closetex(string fname, list #) 
-USAGE:   closetex(fname[,style]); fname,style = string
+"USAGE:   closetex(fname[,style]); fname,style = string
 RETURN:  nothing; writes a LaTeX2e closing line into file fname
 NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex 
-         preceeding ">>" end ending ".tex" may miss in fname; 
+         preceeding >> end ending \".tex\" may miss in fname; 
          overwriting an existing file is not possible
 EXAMPLE: example closetex; shows an example
+"
 {
   string default = "latex2e";    
@@ -87,9 +89,10 @@
 
 proc tex(string fname, list #)
-USAGE:   tex(fname[,style]); fname,style = string
+"USAGE:   tex(fname[,style]); fname,style = string
 RETURN:  nothing; calls latex2e for compiling the file fname
 NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex 
          ending ".tex" may miss in fname        
 EXAMPLE: example tex; shows an example
+"
 { 
   string default = "latex2e";
@@ -139,9 +142,10 @@
 
 proc opentex(string fname, list #)         
-USAGE:   opentex(fname[,style]); fname,style = string
+"USAGE:   opentex(fname[,style]); fname,style = string
 RETURN:  nothing; writes as LaTeX2e header into a new file fname
 NOTE:    suffix .tex may miss in fname
          style overwrites the default setting latex2e; may be latex,amstex,tex 
 EXAMPLE: example opentex; shows an example
+"
 { 
   string default = "latex2e";
@@ -225,12 +229,12 @@
 
 proc texdemo(list #) 
-USAGE:   texdemo();
+"USAGE:   texdemo();
 RETURN:  nothing; generates automatically a LaTeX2e file called: texlibdemo.tex
-         explaining the  features of tex.lib and its gloabl variables
-NOTE:    this proc takes some minutes         
+         explaining the  features of latex.lib and its gloabl variables
+NOTE:    this proc takes a minutes         
 EXAMPLE: example texdemo; executes the generation
+"
 { int TeXdemostart = system("pid");
   string fname = "texlibdemo";
-  string fnamet = fname+ ".tex";
 
   if (size(#)) 
@@ -270,10 +274,11 @@
 
 proc texfactorize(string fname, poly f, list #) 
-USAGE:   opentex(fname,f); fname = string; f = poly
+"USAGE:   opentex(fname,f); fname = string; f = poly
 RETURN:  string, the poly as as product of its irreducible factors
                  in TeX-typesetting if fname == empty string;
          otherwise append this to file fname.tex; return nothing  
-NOTE:    preceeding ">>" end ending ".tex" may miss in fname 
+NOTE:    preceeding >> end ending \".tex\" may miss in fname 
 EXAMPLE: example texfactorize; shows an example
+"
 {
   def @r = basering;
@@ -342,10 +347,11 @@
 
 proc texmap(string fname, def m, def @r1, def @r2, list #)
-USAGE:   texmap(fname,f); fname = string; m = string/map, @r1,@r2 = ring
+"USAGE:   texmap(fname,f); fname = string; m = string/map, @r1,@r2 = ring
 RETURN:  string, the map m from @r1 to @r2 preeceded by its name if m = string
                  in TeX-typesetting if fname == empty string;
          otherwise append this to file fname.tex; return nothing  
-NOTE:    preceeding ">>" end ending ".tex" may miss in fname 
+NOTE:    preceeding >> end ending \".tex\" may miss in fname 
 EXAMPLE: example texmap; shows an example
+"
 { 
   int saveDollars= defined(NoDollars);
@@ -489,9 +495,10 @@
 
 proc texname(string fname, string s) 
-USAGE:   texname(fname,s);  fname,s = string
-RETURN:  the string s if fname == the empty string "" ;
+"USAGE:   texname(fname,s);  fname,s = string
+RETURN:  the string s if fname == the empty string
          otherwise append s to file fname.tex; return nothing 
-NOTE:    preceeding ">>" end ending ".tex" may miss in fname;         
+NOTE:    preceeding >> end ending \".tex\" may miss in fname         
 EXAMPLE: example texname; shows an example
+"
 {
   string st, extr;
@@ -565,9 +572,10 @@
 
 proc texobj(string fname, list #)
-USAGE:   texobj(fname,l); fname = string,l = list of Singular dataypes
+"USAGE:   texobj(fname,l); fname = string,l = list of Singular dataypes
 RETURN:  string, the objects in TeX-typesetting if fname == empty string;
          otherwise append this to file fname.tex; return nothing    
 NOTE:    preceeding ">>" end ending ".tex" may miss in fname;         
 EXAMPLE: example texobj; shows an example
+"
 {
  int i,j,k,nr,nc,linear,Tw,Dollars;
@@ -844,11 +852,12 @@
 
 proc texproc(string fname,string pname) 
-USAGE:   opentex(fname,pname); fname,pname = string
+"USAGE:   opentex(fname,pname); fname,pname = string
 RETURN:  string, the proc in a verbatim environment in TeX-typesetting 
                  if fname == empty string;
          otherwise append this to file fname.tex; return nothing  
-NOTE:    preceeding ">>" end ending ".tex" may miss in fname; 
+NOTE:    preceeding >> end ending \".tex\" may miss in fname; 
 CAUTION: texproc cannot applied on itself correctly         
 EXAMPLE: example texproc; shows an example
+"
 {
   int i,j=1,1;
@@ -912,11 +921,12 @@
 
 proc texring(string fname, def r, list #) 
-USAGE:   texring(fname, r[,l]); fname = string; r = ring;
-                                l=list of strings : controls the symbol for
-                                coefficint field etc. see example texdemo(); 
+"USAGE:   texring(fname, r[,l]); fname = string; r = ring;
+         l=list of strings : controls the symbol for
+         coefficient field etc. see example texdemo(); 
 RETURN:  string, the ring in TeX-typesetting if fname == empty string;
          otherwise append this to file fname.tex; return nothing    
-NOTE:    preceeding ">>" end ending ".tex" may miss in fname;        
+NOTE:    preceeding >> end ending \".tex\" may miss in fname;        
 EXAMPLE: example texring; shows an example
+"
 { 
   int i,galT,flag,mipo,nopar,Dollars,TB,TA;
@@ -1096,10 +1106,11 @@
 
 proc rmx(string fname)
-USAGE:   rmx(fname); fname = string
+"USAGE:   rmx(fname); fname = string
 RETURN:  nothing; removes .log and .aux files associated to file <fname>      
-         removes tex and xdvi file too, if suffix ".tex" or ".dvi" is given
+         removes tex and xdvi file too, if suffix \".tex\" or \".dvi\" is given
 NOTE:    if fname ends by .dvi or .tex 
          fname.dvi or fname.dvi and fname.tex will be deleted, too           
 EXAMPLE: example rmx; shows an example
+"
 {
   int i,suffix= 1,0;
@@ -1149,9 +1160,10 @@
 
 proc xdvi(string fname, list #)
-USAGE:   xdvi(fname[,style]); fname,style = string
+"USAGE:   xdvi(fname[,style]); fname,style = string
 RETURN:  nothing; displays dvi-file fname.dvi with previewer xdvi
 NOTE:    ending .dvi may miss in fname
          style overwrites the default setting xdvi
-EXAMPLE: example xdvi ; shows an example
+EXAMPLE: example xdvi; shows an example
+"
 {
   int i=1;
@@ -1196,4 +1208,10 @@
 
 proc texpoly(string fname,def p,list #)
+"USAGE:   texpoly(fname,p[,l]); fname = string; p = poly,ideal; l formation str
+RETURN:  string, the objects in TeX-typesetting if fname == empty string;
+         otherwise append this to file fname.tex; return nothing    
+NOTE:    preceeding ">>" end ending ".tex" may miss in fname;      
+EXAMPLE: example texpoly; shoes an example
+"
 { 
   def @r = basering;
@@ -1429,5 +1447,5 @@
 }     
 
-proc parsp(string cfmt, int b)
+static proc parsp(string cfmt, int b)
 { string mt, nom,denom;
   int fl1,fl2,sz1,sz2,msz;
@@ -1465,5 +1483,5 @@
 }
 
-proc parst(string s,int sec)                // parse parameter
+static proc parst(string s,int sec)                // parse parameter
 // sec parameter to see if in parsp a fraction follows
 { int i,j =1,-1;
@@ -1599,5 +1617,5 @@
 
 
-proc parselong(string s)
+static proc parselong(string s)
 { 
   int i,j,k,b,mz;
@@ -1663,5 +1681,5 @@
 /////////////////////////////  PART0 //////////////////////////////////////////
 
-proc part0(string fname)
+static proc part0(string fname)
 {
  int texdemopart =0;
@@ -1676,5 +1694,5 @@
  //echo =2;
 
-   proc randompoly(int n,int cm,int em)
+  proc randompoly(int n,int cm,int em)
    {
     int i,j,k;
@@ -1687,18 +1705,13 @@
       if (np) 
       {  
-      // for(k=1; k<=2;k++)   // zwei Terme
-      // {
          nm=random(-cm,cm);
          for (j=1;j<=np;j++)
          { nm=nm*par(j)^random(-em/ 2,em/ 2);}
          nom = nom + nm;
-      // }
-      // for(k=1; k<=2;k++)   // zwei Terme
-      // { 
+
          nm=random(-cm,cm);
          for (j=1;j<=np;j++)
          { nm=nm*par(j)^random(-em/ 2,em/ 2);}
          denom = denom + nm;
-      // }
        if (denom!=0) {g = nom*denom^-1;}
        else {g = 0;}
@@ -1775,27 +1788,29 @@
 
  write(fname,"\\section{Introduction}");
- write(fname,"The procedures in \\verb|tex.lib| translate the output of
- Singular in \\LaTeX text. Most of the examples in this document are generated
- randomly by Singular itself and passed through the procs from \\verb|tex.lib|.
- Consequently, every document doesnot show merely how the \\verb|tex.lib| works
+ write(fname,"The procedures in \\verb|latex.lib| translate the output of
+ Singular in \\LaTeX \\ text.
+ Most of the examples in this document are generated
+ randomly by Singular itself and passed through the procs from 
+ \\verb|latex.lib|. Consequently, 
+ every document does not show merely how the \\verb|latex.lib| works
  but looks differently in large parts.");
  write(fname,bv +
 "
-
-LIBRARY: tex.lib      PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN TEX
- 
- closetex(s);         writes closing line for TeX-document
- opentex(s);          writes header for TeX-file s
- tex(s);              call latex for TeX-file s
- texdemo();           produces a latex file explaining the features of this lib
- texfactorize(fname,f); create string in TeX-Symbolformat for factors of poly f
- texmap(fname,m,r1,r2); create string in TeX-Symbolformat for map m:r1->r2
- texname(fname,s);    create string in TeX-Symbolformat for identifier
+LIBRARY: latex.lib    PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN LATEX2E
+
+
+ closetex(fnm);       writes closing line for TeX-document
+ opentex(fnm);        writes header for TeX-file fnm
+ tex(fnm);            calls LaTeX2e for TeX-file fnm
+ texdemo([n]);        produces a file explaining the features of this lib
+ texfactorize(fnm,f); creates string in TeX-Symbolformat for factors of poly f
+ texmap(fnm,m,r1,r2); creates string in TeX-Symbolformat for map m:r1->r2
+ texname(fnm,s);      creates string in TeX-Symbolformat for identifier
  texobj(l);           creates string in TeX-Symbolformat for any (basic) type
  texpoly(f,n[,l]);    creates string in TeX-Symbolformat for poly
- texproc(fname,p);    create string in TeX-Symbolformat of text from proc p
- texring(fname,r[,l]); create string in TeX-Symbolformat for ring/qring
- rmx(s);              remove .aux and .log files of TeXfile s
- xdvi(s);             call xdvi for dvi-file s
+ texproc(fnm,p);      creates string in TeX-Symbolformat of text from proc p
+ texring(fnm,r[,l]);  creates string in TeX-Symbolformat for ring/qring
+ rmx(s);              removes .aux and .log files of TeXfile s
+ xdvi(s);             calls xdvi for dvi-file s
          (parameters in square brackets [] are optional)
  
@@ -1803,5 +1818,5 @@
   TeXwidth, TeXnofrac, TeXbrack, TeXproj, TeXaligned, TeXreplace, NoDollars
                are used to control the typesetting  
-    Call example texdemo; to become familiar with the features of tex.lib
+    Call example texdemo; to become familiar with the features of latex.lib
 
 " +
@@ -1833,8 +1848,8 @@
    write(fname,"\\section{Opening a \\LaTeX\\ file}");
    write(fname,"All starts by defining a variable " + nl 
-                + bv + "> string fname = \"tldemo.tex\";" + nl +
+                + bv + "> string fname = \"" + fname + "\";" + nl +
                 "> texopen(fname);" + ev + nl);
  write(fname,"This variable \\verb|fname| has to given as first argument to
- all procedures in \\verb|tex.lib|");
+ all procedures in \\verb|latex.lib|");
  
  //% opentex, defaulted to latex, possibly extension are ... and
@@ -1843,5 +1858,5 @@
 
 pagewidth = 65;
-int TeXwidth = 80; export TeXwidth;
+int TeXwidth = 100; export TeXwidth;
  "part 0 generated " + nl;
 } //part0
@@ -1851,5 +1866,5 @@
 
 
-proc part1(string fname)
+static proc part1(string fname)
 { int st = defined(texdemopart);
 
@@ -2006,14 +2021,14 @@
 
 
-// -6b------- a ring in char 11, and indexed parameters --------- ----------
+// -6b------- a ring in char 11003, and indexed parameters --------- ----------
 write(fname,
 " A ring in characteristic 11 and indexed parameters.
 " +nl);
- ring rt=(11111,t1,t2,t3),(X,Y),dp;            
+ ring rt=(11003,t1,t2,t3),(X,Y),dp;            
  poly g = 8*(-t1+t2)/(t1+t3)*X + t2*Y -1; g;      
  poly f = randompoly(5,25,25); f;
 write(fname,
 bv +
-"> ring rt=(11111,t1,t2,t3),(X,Y),dp;             texring(fname,rt);
+"> ring rt=(11003,t1,t2,t3),(X,Y),dp;             texring(fname,rt);
 > poly g = 8*(-t1+t2)/(t1+t3)*X + t2*Y -1; g; texpoly(fname,g);" +nl +
  string(g) + nl + 
@@ -2096,5 +2111,5 @@
 // -10--------- a quotient ring performed from  ----------
 write(fname,
-" A quotient ring .
+" A quotient ring performed from \\verb|r0|
 " +nl);
  setring r0;
@@ -2196,5 +2211,5 @@
 
 write(fname,"Any correct letter in \\LaTeX \\ notation may be used to describe
-the coefficientfield. If the letter is k, K or R it should ! forcew texring 
+the coefficientfield. If the letter is k, K or R it  forces \\verb|texring| 
 not to print the parameters. This will be useful for a ring described by an
 algebraic extension",nl2);
@@ -2209,5 +2224,17 @@
  
 // texobj(fname,"with k = ");
- 
+
+write(fname,nl2,
+"The algebraic extension is diplayed with the optional paramater
+\\verb|mipo|");
+write(fname,
+bv +
+"> texring(fname,ralg,\"mipo\");" + nl +  
+ev
+); 
+
+texring(fname, ralg,"mipo");
+
+
 write(fname,nl,"\\Line");
 // displaying only certain vars
@@ -2245,6 +2272,6 @@
 // passing over additional information
 
-write(fname,"If you want to mark a ring as the Invariantring under a group,
-additional informations starting with \\verb|^| will be added.",nl2);
+write(fname,"If you want to mark a ring as the invariantring under a group,
+additional informations starting with \\verb|^| may be added.",nl2);
 
 write(fname,
@@ -2257,6 +2284,6 @@
  
 write(fname,nl2,"All these arguments may be passed over in any order as 
-optional arguments, but it may completely  --- result if too much of them 
-are used at the same time",nl);
+optional arguments, but it may give a rather nonsense result if too much of 
+them  are used at the same time",nl);
 
 write(fname,
@@ -2278,5 +2305,5 @@
 
 
-proc part2(string fname)
+static proc part2(string fname)
 { int st = defined(texdemopart);
 
@@ -2328,9 +2355,9 @@
 
 
-write(fname,nl2,"If \\verb|texfactorize| is called by the name of the polynom, 
-the result is the following" + lb,nl);
-
-
-write(fname,nl2, "Noch nicht implemtiert" + lb,nl2);
+//write(fname,nl2, If \\verb|texfactorize| is called by the name of the
+// polynom, the result is the following" + lb,nl);
+
+
+// write(fname,nl2, "Noch nicht implemtiert" + lb,nl2);
 
 
@@ -2351,8 +2378,11 @@
 write(fname,"The global variable \\verb|TeXreplace| must be a list 
 whose entries are twoelemented lists again; wherby the first entry is the
-word which should be replaced and second is the replacing word." + lb +
-"---- ---- this holds for texname anmd texmap too ---- ---- " + lb +
-"It is most usefule to write the greec letters correctly. Notice to write
-a \\verb|\\\\\ |  at the beginning of a \\TeX \\ symbol." + lb);
+word which should be replaced and second is the replacing word."  +
+"This is may be applied to replace variablenames, but holds  also for texname 
+anmd texmap" + lb +
+"It is most useful to write the greece letters correctly. Notice that it
+is necesarry to write
+a double backslash \\verb|\\\\\ | at the beginning of 
+a \\TeX \\ symbol." + lb);
 
 
@@ -2411,6 +2441,6 @@
 kill TeXreplace;
 
-write(fname,"If \\verb|TeXreplace| is defined, the translation into \\TeX--code
-runs significantly slower, because every polynom will be compiled in the 
+write(fname,"If \\verb|TeXreplace| is defined, the translation into \\TeX  code
+runs significantly slower, because every polynomial will be compiled in the 
 \\verb|non short| mode."+ lb );
 
@@ -2434,5 +2464,5 @@
 "\\]",nl);
 
-write(fname,"Notice that two letters as x counts as three subscripts or 
+write(fname,"Notice that two letters like x counts as three subscripts or 
 exponents",nl);
 
@@ -2441,7 +2471,7 @@
 //----------------------------------------------------------
 
-write(fname,"\\verb|TeXwidth| is the only global variable which will be 
-from Singular automatically. Its default value is -1 
-i.e. wrapping is set off"+ lb);
+write(fname,"\\verb|TeXwidth| is the only global variable which will be defined
+automatically from Singular. Its default value is -1 
+i.e. wrapping is set off."+ lb);
 
 // Examples:
@@ -2450,5 +2480,5 @@
 write(fname,"\\item",nl);
 
-write(fname,"Up to now the value is -1");
+write(fname,"Up to now the value is " + string(TeXwidth)+".");
 
 write(fname,
@@ -2512,7 +2542,7 @@
 write(fname,nl2,"\\Line",nl);
 
-write(fname,nl2, " offset for poly " + lb, nl);
-
-write(fname,nl2,"\\Line",nl);
+//write(fname,nl2, " offset for poly " + lb, nl);
+
+//write(fname,nl2,"\\Line",nl);
 
 write(fname,"As seen there are two possibilities to tex a polynomial. The 
@@ -2521,17 +2551,16 @@
 " The command \\verb|texobj| is the most general one, if a polynomial
 will be texed with this command, it will be written in display mode and
-the length of the terms will be counted .... ." + lb,nl2,
+the length of the terms will be counted appropriately ." + lb,nl2,
 "Let us compare the output for \\verb|texpoly| and \\verb|texobj|."+lb);
 
-
 write(fname,
 bv +
 "> setring r3;
-> texpoly(fname,f);" + nl + 
+> texpoly(fname,f/180);" + nl + 
 ev);
 
 
 setring r3;
-texpoly(fname,f); 
+texpoly(fname,f/180); 
 
 write(fname,nl2, "Now the same again with \\verb|texobj| "+ lb,nl);
@@ -2539,9 +2568,9 @@
 write(fname,
 bv +
-"> texobj(fname,f);
+"> texobj(fname,f/180);
 " + nl +
 ev);
 
-texobj(fname,f);
+texobj(fname,f/180);
 
 
@@ -2587,5 +2616,5 @@
 write(fname,"\\Line");
 //----------------------------------------------------------------------
-write(fname,"If you prefer other brackets just set them");
+write(fname,"If other brackets are prefered, just set them");
 
 write(fname,
@@ -2685,5 +2714,5 @@
 
 
-proc part3(string fname)
+static proc part3(string fname)
 { int st = defined(texdemopart);
 
@@ -3015,9 +3044,9 @@
 //----------------------------------texname-------------------
 
-write(fname,"\\section{Names of identifiers}");
-
-
-write(fname,"The proc \\verb|texname| is used to write indexed names in a 
-correct way"+lb,nl);
+//write(fname,"\\section{Names of identifiers}");
+
+
+//write(fname,"The proc \\verb|texname| is used to write indexed names in a 
+//correct way"+lb,nl);
 
 
@@ -3027,5 +3056,5 @@
  write(fname,"Finally, here is the procedure we used to generate the random
 polynomials.");
-  write(fname,"\\newpage");
+ // write(fname,"\\newpage");
   texproc(fname,"randompoly");
 
@@ -3037,8 +3066,10 @@
 "\\verb|tex(fname)| and displayed with \\verb|xdvi(fname)|");
 
-write(fname,"\\section{Remarks}");
+// write(fname,"\\section{Remarks}");
 closetex(fname);
 
 "end of part3" + nl;
+
+pagewidth =80;
 }
 
