Changeset 6a7528 in git for Singular/LIB


Ignore:
Timestamp:
Oct 14, 1998, 4:34:47 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
7dd1eb69f369db2af3361bc75dca312c9b13fd5a
Parents:
71b3e09c22ef3f3c49a802901ccf49f7ea706f6f
Message:
*hannes: lag number soutput


git-svn-id: file:///usr/local/Singular/svn/trunk@2567 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/latex.lib

    r71b3e0 r6a7528  
    1 // $Id: latex.lib,v 1.3 1998-08-07 17:33:55 gorzel Exp $   
     1// $Id: latex.lib,v 1.4 1998-10-14 14:34:47 Singular Exp $   
    22//                        1998/04/17
    33// author : Christian Gorzel email: gorzelc@math.uni-muenster.de
     
    14891489  int saveshort=short;
    14901490            string t,c,vn,nom,denom,sg;
    1491 
    1492   s = s[2,size(s)-2];    s = s + "!";
     1491  if (s[1]=="(") { s = s[2,size(s)-2]; }
     1492  s = s + "!";
    14931493
    14941494  if(defined(TeXreplace)){ short =0;}   // only then replacing works correctly
     
    14971497    { b=i; j++;
    14981498      while(s[i]>="0" and s[i]<="9" or (s[i]=="+" or s[i]=="-") and s[i]!="!")
    1499       {i++;}     // scan the number 
     1499      {i++;}     // scan the number
    15001500        t =s[b,i-b];
    15011501    //  if (t=="-1" and s[i]!="!" and s[i]!="-" and s[i]!="+"){t = "-";}
    15021502      if (t=="-1" and (s[i]<="0" or s[i]>="9") and s[i]!= "/" and s[i]!="!")
    15031503       {
    1504      t = "-";} 
    1505       if (s[i]=="/")     
     1504     t = "-";}
     1505      if (s[i]=="/")
    15061506      { i++;
    15071507        sg = "";
     
    15111511        }
    15121512        else { nom = t;}
    1513         b =i; 
     1513        b =i;
    15141514        while(s[i]>="0" and s[i]<="9") {i++;}
    15151515        denom = s[b,i-b];
     
    15191519        { t = sg + "(" + nom + "/" + denom + ")";
    15201520        }
    1521       } 
     1521      }
    15221522      c = c + t;
    15231523      if(s[i]!="!"){c = c + s[i]; i++;}      // the parameter
     
    15291529   }
    15301530   else                         // if not short ....
    1531    { while (s[i] <> "!") 
     1531   { while (s[i] <> "!")
    15321532     { b=i; j++;
    15331533       while(s[i]=="-" or s[i]=="+" or (s[i]>="0" and s[i]<="9")){i++;}
    15341534       t = s[b,i-b];
    15351535       if (t=="-1" and s[i]=="*" ) {t="-";}
    1536       if (s[i]=="/") 
     1536      if (s[i]=="/")
    15371537      { i++;
    15381538        sg = "";
     
    15421542        }
    15431543        else { nom = t;}
    1544         b =i; 
     1544        b =i;
    15451545        while(s[i]>="0" and s[i]<="9") {i++;}
    15461546        denom = s[b,i-b];
     
    15501550        { t = sg + "(" + nom + "/" + denom + ")";
    15511551        }
    1552       } 
    1553        c = c+t; t="";   
    1554        if (s[i]=="*"){i++;} 
     1552      }
     1553       c = c+t; t="";
     1554       if (s[i]=="*"){i++;}
    15551555       b=i;
    15561556       while(s[i]!="+" and s[i]!="-" and s[i]!="!")  //pass a monom
    1557        { // start with letters 
     1557       { // start with letters
    15581558        // alternativ:
    15591559        while((s[i]>="a" and s[i]<="z") or (s[i]>="A" and s[i]<="Z")){i++;}
    1560              k = i-b; 
     1560             k = i-b;
    15611561        vn = s[b,k];
    15621562        if (defined(TeXreplace))
    1563         { for (jj=1; jj<= size(TeXreplace);jj++) 
    1564          { if (vn == TeXreplace[jj][1]) 
     1563        { for (jj=1; jj<= size(TeXreplace);jj++)
     1564         { if (vn == TeXreplace[jj][1])
    15651565           {vn = TeXreplace[jj][2]; k=1;
    1566              if (s[i]=="*") {vn = vn + " ";} 
     1566             if (s[i]=="*") {vn = vn + " ";}
    15671567            break;} //suppose replacing by a single sign
    15681568         }
     
    15981598  f;
    15991599  parst(string(f));
    1600  
     1600
    16011601  f =(-a +4b2 -2);
    16021602  f;
    16031603  parst(string(f));
    1604  
     1604
    16051605  f = a23;
    16061606  f;
     
    16181618
    16191619static proc parselong(string s)
    1620 { 
     1620{
    16211621  int i,j,k,b,mz;
    16221622  string t,vn;              // varname
    1623  
     1623
    16241624 // "s=" + s;
    1625   i = 1; 
    1626   while (s[i] <> "!") 
    1627   { b=i;     
    1628    
     1625  i = 1;
     1626  while (s[i] <> "!")
     1627  { b=i;
     1628
    16291629// -- scan now the letter ...
    16301630
     
    16351635 { i++;}
    16361636 // s[i]; i;
    1637    k = i-b; 
     1637   k = i-b;
    16381638   vn = s[b,k];
    16391639
    16401640   if (defined(TeXreplace))
    1641    { for (j=1; j<= size(TeXreplace);j++) 
    1642      { if (vn == TeXreplace[j][1]) 
     1641   { for (j=1; j<= size(TeXreplace);j++)
     1642     { if (vn == TeXreplace[j][1])
    16431643       {vn = TeXreplace[j][2]; k=1;
    1644         if (s[i]=="*") {vn = vn + " ";} 
     1644        if (s[i]=="*") {vn = vn + " ";}
    16451645         break;} //suppose replacing by a single sign
    16461646     }
     
    16671667}
    16681668example
    1669 { "EXAMPLE:"; echo =2; 
     1669{ "EXAMPLE:"; echo =2;
    16701670  ring r =(49,a),x,dp;
    16711671  number f = a13;
     
    16741674  TeXreplace[1] = list("b","\\beta");
    16751675  TeXreplace[2] = list("a","\\alpha");
    1676   TeXreplace[3] = list("c","\\gamma"); 
     1676  TeXreplace[3] = list("c","\\gamma");
    16771677  parselong(string(f)+"!");
    16781678}
     
    17171717    poly f,g;
    17181718    int nv,np=nvars(basering),npars(basering);
    1719  
     1719
    17201720    for (i=1; i<=n; i++)
    1721     { 
    1722       if (np) 
    1723       { 
     1721    {
     1722      if (np)
     1723      {
    17241724         nm=random(-cm,cm);
    17251725         for (j=1;j<=np;j++)
     
    17511751  {
    17521752   int i;
    1753    
     1753
    17541754   for(i=1; i<=n; i++)
    1755    { 
     1755   {
    17561756    v[i];
    17571757   }
     
    17631763    int p;
    17641764    string t;
    1765    
     1765
    17661766    while(n-i+1 >pagewidth)
    17671767    { p = find(s,newline,i);
     
    18311831 xdvi(s);             calls xdvi for dvi-file s
    18321832         (parameters in square brackets [] are optional)
    1833  
    1834                       Global Variables: 
     1833
     1834                      Global Variables:
    18351835  TeXwidth, TeXnofrac, TeXbrack, TeXproj, TeXaligned, TeXreplace, NoDollars
    1836                are used to control the typesetting 
     1836               are used to control the typesetting
    18371837    Call example texdemo; to become familiar with the features of latex.lib
    18381838
     
    18641864//----------------------- opentex -----------------------------
    18651865   write(fname,"\\section{Opening a \\LaTeX\\ file}");
    1866    write(fname,"All starts by defining a variable " + nl 
     1866   write(fname,"All starts by defining a variable " + nl
    18671867                + bv + "> string fname = \"" + fname + "\";" + nl +
    18681868                "> texopen(fname);" + ev + nl);
    18691869 write(fname,"This variable \\verb|fname| has to given as first argument to
    18701870 all procedures in \\verb|latex.lib|");
    1871  
     1871
    18721872 //% opentex, defaulted to latex, possibly extension are ... and
    1873  //% ``own'' 
     1873 //% ``own''
    18741874
    18751875
     
    18911891  }
    18921892  else { texdemopart=1; }
    1893  
     1893
    18941894"Continuing part1 of " + fname + nl;
    18951895
     
    19021902" +nl);
    19031903 ring r0=0,(x,y,z),dp;        export r0;
    1904  poly g = -x2y +2y13z +1;           export g;         
     1904 poly g = -x2y +2y13z +1;           export g;
    19051905 poly f = randompoly(5,25,25); f;      export f;
    19061906write(fname,
     
    19101910 string(g) + nl +
    19111911"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    1912  splt(string(f)) + nl2 + 
    1913 ev 
    1914 ); 
     1912 splt(string(f)) + nl2 +
     1913ev
     1914);
    19151915  texring(fname,r0);              write(fname,nl2);
    1916   texpoly(fname,g);              write(fname,nl2); 
     1916  texpoly(fname,g);              write(fname,nl2);
    19171917  texpoly(fname,f);              write(fname,nl2);
    19181918// write(fname,"\\Line");
     
    19291929 splt(string(f)) + nl2 +
    19301930ev
    1931 ); 
     1931);
    19321932  texpoly(fname,f);              write(fname,nl2);
    19331933write(fname,"\\Line");
Note: See TracChangeset for help on using the changeset viewer.