Changeset 6a7528 in git for Singular/LIB
- Timestamp:
- Oct 14, 1998, 4:34:47 PM (26 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 7dd1eb69f369db2af3361bc75dca312c9b13fd5a
- Parents:
- 71b3e09c22ef3f3c49a802901ccf49f7ea706f6f
- 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 gorzelExp $1 // $Id: latex.lib,v 1.4 1998-10-14 14:34:47 Singular Exp $ 2 2 // 1998/04/17 3 3 // author : Christian Gorzel email: gorzelc@math.uni-muenster.de … … 1489 1489 int saveshort=short; 1490 1490 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 + "!"; 1493 1493 1494 1494 if(defined(TeXreplace)){ short =0;} // only then replacing works correctly … … 1497 1497 { b=i; j++; 1498 1498 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 1500 1500 t =s[b,i-b]; 1501 1501 // if (t=="-1" and s[i]!="!" and s[i]!="-" and s[i]!="+"){t = "-";} 1502 1502 if (t=="-1" and (s[i]<="0" or s[i]>="9") and s[i]!= "/" and s[i]!="!") 1503 1503 { 1504 t = "-";} 1505 if (s[i]=="/") 1504 t = "-";} 1505 if (s[i]=="/") 1506 1506 { i++; 1507 1507 sg = ""; … … 1511 1511 } 1512 1512 else { nom = t;} 1513 b =i; 1513 b =i; 1514 1514 while(s[i]>="0" and s[i]<="9") {i++;} 1515 1515 denom = s[b,i-b]; … … 1519 1519 { t = sg + "(" + nom + "/" + denom + ")"; 1520 1520 } 1521 } 1521 } 1522 1522 c = c + t; 1523 1523 if(s[i]!="!"){c = c + s[i]; i++;} // the parameter … … 1529 1529 } 1530 1530 else // if not short .... 1531 { while (s[i] <> "!") 1531 { while (s[i] <> "!") 1532 1532 { b=i; j++; 1533 1533 while(s[i]=="-" or s[i]=="+" or (s[i]>="0" and s[i]<="9")){i++;} 1534 1534 t = s[b,i-b]; 1535 1535 if (t=="-1" and s[i]=="*" ) {t="-";} 1536 if (s[i]=="/") 1536 if (s[i]=="/") 1537 1537 { i++; 1538 1538 sg = ""; … … 1542 1542 } 1543 1543 else { nom = t;} 1544 b =i; 1544 b =i; 1545 1545 while(s[i]>="0" and s[i]<="9") {i++;} 1546 1546 denom = s[b,i-b]; … … 1550 1550 { t = sg + "(" + nom + "/" + denom + ")"; 1551 1551 } 1552 } 1553 c = c+t; t=""; 1554 if (s[i]=="*"){i++;} 1552 } 1553 c = c+t; t=""; 1554 if (s[i]=="*"){i++;} 1555 1555 b=i; 1556 1556 while(s[i]!="+" and s[i]!="-" and s[i]!="!") //pass a monom 1557 { // start with letters 1557 { // start with letters 1558 1558 // alternativ: 1559 1559 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; 1561 1561 vn = s[b,k]; 1562 1562 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]) 1565 1565 {vn = TeXreplace[jj][2]; k=1; 1566 if (s[i]=="*") {vn = vn + " ";} 1566 if (s[i]=="*") {vn = vn + " ";} 1567 1567 break;} //suppose replacing by a single sign 1568 1568 } … … 1598 1598 f; 1599 1599 parst(string(f)); 1600 1600 1601 1601 f =(-a +4b2 -2); 1602 1602 f; 1603 1603 parst(string(f)); 1604 1604 1605 1605 f = a23; 1606 1606 f; … … 1618 1618 1619 1619 static proc parselong(string s) 1620 { 1620 { 1621 1621 int i,j,k,b,mz; 1622 1622 string t,vn; // varname 1623 1623 1624 1624 // "s=" + s; 1625 i = 1; 1626 while (s[i] <> "!") 1627 { b=i; 1628 1625 i = 1; 1626 while (s[i] <> "!") 1627 { b=i; 1628 1629 1629 // -- scan now the letter ... 1630 1630 … … 1635 1635 { i++;} 1636 1636 // s[i]; i; 1637 k = i-b; 1637 k = i-b; 1638 1638 vn = s[b,k]; 1639 1639 1640 1640 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]) 1643 1643 {vn = TeXreplace[j][2]; k=1; 1644 if (s[i]=="*") {vn = vn + " ";} 1644 if (s[i]=="*") {vn = vn + " ";} 1645 1645 break;} //suppose replacing by a single sign 1646 1646 } … … 1667 1667 } 1668 1668 example 1669 { "EXAMPLE:"; echo =2; 1669 { "EXAMPLE:"; echo =2; 1670 1670 ring r =(49,a),x,dp; 1671 1671 number f = a13; … … 1674 1674 TeXreplace[1] = list("b","\\beta"); 1675 1675 TeXreplace[2] = list("a","\\alpha"); 1676 TeXreplace[3] = list("c","\\gamma"); 1676 TeXreplace[3] = list("c","\\gamma"); 1677 1677 parselong(string(f)+"!"); 1678 1678 } … … 1717 1717 poly f,g; 1718 1718 int nv,np=nvars(basering),npars(basering); 1719 1719 1720 1720 for (i=1; i<=n; i++) 1721 { 1722 if (np) 1723 { 1721 { 1722 if (np) 1723 { 1724 1724 nm=random(-cm,cm); 1725 1725 for (j=1;j<=np;j++) … … 1751 1751 { 1752 1752 int i; 1753 1753 1754 1754 for(i=1; i<=n; i++) 1755 { 1755 { 1756 1756 v[i]; 1757 1757 } … … 1763 1763 int p; 1764 1764 string t; 1765 1765 1766 1766 while(n-i+1 >pagewidth) 1767 1767 { p = find(s,newline,i); … … 1831 1831 xdvi(s); calls xdvi for dvi-file s 1832 1832 (parameters in square brackets [] are optional) 1833 1834 Global Variables: 1833 1834 Global Variables: 1835 1835 TeXwidth, TeXnofrac, TeXbrack, TeXproj, TeXaligned, TeXreplace, NoDollars 1836 are used to control the typesetting 1836 are used to control the typesetting 1837 1837 Call example texdemo; to become familiar with the features of latex.lib 1838 1838 … … 1864 1864 //----------------------- opentex ----------------------------- 1865 1865 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 1867 1867 + bv + "> string fname = \"" + fname + "\";" + nl + 1868 1868 "> texopen(fname);" + ev + nl); 1869 1869 write(fname,"This variable \\verb|fname| has to given as first argument to 1870 1870 all procedures in \\verb|latex.lib|"); 1871 1871 1872 1872 //% opentex, defaulted to latex, possibly extension are ... and 1873 //% ``own'' 1873 //% ``own'' 1874 1874 1875 1875 … … 1891 1891 } 1892 1892 else { texdemopart=1; } 1893 1893 1894 1894 "Continuing part1 of " + fname + nl; 1895 1895 … … 1902 1902 " +nl); 1903 1903 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; 1905 1905 poly f = randompoly(5,25,25); f; export f; 1906 1906 write(fname, … … 1910 1910 string(g) + nl + 1911 1911 "> poly f = randompoly(5,25,25); f; texpoly(fname,f);" +nl + 1912 splt(string(f)) + nl2 + 1913 ev 1914 ); 1912 splt(string(f)) + nl2 + 1913 ev 1914 ); 1915 1915 texring(fname,r0); write(fname,nl2); 1916 texpoly(fname,g); write(fname,nl2); 1916 texpoly(fname,g); write(fname,nl2); 1917 1917 texpoly(fname,f); write(fname,nl2); 1918 1918 // write(fname,"\\Line"); … … 1929 1929 splt(string(f)) + nl2 + 1930 1930 ev 1931 ); 1931 ); 1932 1932 texpoly(fname,f); write(fname,nl2); 1933 1933 write(fname,"\\Line");
Note: See TracChangeset
for help on using the changeset viewer.