Changeset 1c1d96b in git for Singular


Ignore:
Timestamp:
Feb 7, 2001, 2:47:50 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
a23181f4691407c0dda201f7522421b947e214b2
Parents:
9e58366eade0dde081d5a55b0d3f5eaaa799acbf
Message:
*hannes: cosmetics


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/latex.lib

    r9e5836 r1c1d96b  
    11e///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: latex.lib,v 1.15 2001-02-07 09:29:32 lossen Exp $";
     2version="$Id: latex.lib,v 1.16 2001-02-07 13:47:50 Singular Exp $";
    33//category="Visualization";
    44info="
     
    2525  TeXwidth, TeXnofrac, TeXbrack, TeXproj, TeXaligned, TeXreplace, NoDollars
    2626  are used to control the typesetting.
    27   Call @code{example texdemo;} to become familiar with the features of 
     27  Call @code{example texdemo;} to become familiar with the features of
    2828  @code{latex.lib}.
    2929@format
    3030  @code{TeXwidth} (int) -1, 0, 1..9, >9:  controls breaking of long polynomials
    3131  @code{TeXnofrac} (int) flag:  write 1/2 instead of \\frac@{1@}@{2@}
    32   @code{TeXbrack} (string) \"@{\", \"(\", \"<\", \"|\", empty string: 
     32  @code{TeXbrack} (string) \"@{\", \"(\", \"<\", \"|\", empty string:
    3333                                   controls brackets around ideals and matrices
    3434  @code{TeXproj} (int) flag:  write \":\" instead of \",\" in vectors
     
    131131  texobj("exp001","An ideal ",I);
    132132  closetex("exp001");
    133   tex("exp001"); 
     133  tex("exp001");
    134134  echo=0;
    135135  pause("the created files will be deleted after pressing <RETURN>");
     
    284284proc texfactorize(string fname, poly f, list #)
    285285"USAGE:   texfactorize(fname,f); fname string, f poly
    286 RETURN:  if @code{fname=\"\"}: string, f as a product of its irreducible 
     286RETURN:  if @code{fname=\"\"}: string, f as a product of its irreducible
    287287         factors@*
    288          otherwise: append this string to the file @code{<fname>}, and 
     288         otherwise: append this string to the file @code{<fname>}, and
    289289         return nothing.
    290290NOTE:    preceeding \">>\" are deleted and suffix \".tex\" (if not given)
     
    369369proc texmap(string fname, def m, def @r1, def @r2, list #)
    370370"USAGE:   texmap(fname,m,@r1,@r2); fname string, m string/map, @r1,@r2 rings
    371 RETURN:  if @code{fname=\"\"}: string, the map m from @r1 to @r2 (preceeded 
     371RETURN:  if @code{fname=\"\"}: string, the map m from @r1 to @r2 (preceeded
    372372         by its name if m = string) in TeX-typesetting;@*
    373          otherwise: append this string to the file @code{<fname>}, and 
     373         otherwise: append this string to the file @code{<fname>}, and
    374374         return nothing.
    375 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     375NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    376376         (if not given) is added to @code{fname}.
    377377         If m is a string then it has to be the name of an existing map
     
    561561  n = n+5*(i-anf);
    562562  anf =i;            // the next text in ( , ) as exponent
    563   if (op) 
    564   { 
     563  if (op)
     564  {
    565565    if (s[i]== ","){anf = anf+1;}
    566566    while(s[i] !=")"){ i++;}
     
    580580"USAGE:   texname(fname,s);  fname,s  strings
    581581RETURN:  if @code{fname=\"\"}: string, the transformed string s, where the
    582          following rules apply: 
    583 @example 
     582         following rules apply:
     583@example
    584584      s' + \"~\"             -->  \"\\tilde@{\"+ s' +\"@}\"
    585      \"_\" + int             -->       \"_@{\" + int +\"@}\" 
     585     \"_\" + int             -->       \"_@{\" + int +\"@}\"
    586586  \"[\" + s' + \"]\"           -->      \"_@{\" + s' + \"@}\"
    587    \"A..Z\" + int            --> \"A..Z\" + \"^@{\" + int + \"@}\"   
     587   \"A..Z\" + int            --> \"A..Z\" + \"^@{\" + int + \"@}\"
    588588   \"a..z\" + int            --> \"a..z\" + \"_@{\" + int + \"@}\"
    589589\"(\" + int + \",\" + s' + \")\" --> \"_@{\"+ int +\"@}\" + \"^@{\" + s'+\"@}\"
    590590@end example
    591591         Anyhow, strings which begin with a @code{\"@{\"} are only changed
    592          by deleting the first and last character (intended to remove the 
     592         by deleting the first and last character (intended to remove the
    593593         surrounding curly brackets).
    594594
    595          if @code{fname!=\"\"}: append the transformed string s to the file 
     595         if @code{fname!=\"\"}: append the transformed string s to the file
    596596         @code{<fname>}, and return nothing.
    597 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     597NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    598598         (if not given) is added to @code{fname}.
    599599EXAMPLE: example texname; shows an example
     
    603603  st=manipul(s);
    604604  if (size(fname))
    605   { 
     605  {
    606606    int i=1;
    607607    while (fname[i]==">"){i++;}
    608608    fname = fname[i,size(fname)-i+1];
    609609    if (size(fname)>=4)            // check if filename is ending with ".tex"
    610     { 
     610    {
    611611      if(fname[size(fname)-3,4]!=".tex") {fname = fname +".tex"; }
    612612    }
     
    634634
    635635static proc absterm(poly f)
    636 { 
     636{
    637637  int k;
    638638  for (k=1; k<=nvars(basering); k++)
     
    645645"USAGE:   texobj(fname,l); fname string, l list
    646646RETURN:  if @code{fname=\"\"}: string, the objects in LaTeX-typesetting;@*
    647          otherwise: append this string to the file @code{<fname>}, and 
     647         otherwise: append this string to the file @code{<fname>}, and
    648648         return nothing.
    649 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     649NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    650650         (if not given) is added to @code{fname}.
    651651EXAMPLE: example texobj; shows an example
     
    687687   { if (defined(`obj`))
    688688     { if (typeof(`obj`)=="ideal")
    689        { 
     689       {
    690690         Iname = obj; def e = `obj`;  //convert to correct type ideal
    691691         kill obj; def obj = e; kill e;
     
    900900}
    901901example
    902 { 
     902{
    903903   echo=0;
    904904   // -------- prepare for example ---------
     
    942942"USAGE:   texproc(fname,pname); fname,pname strings
    943943ASSUME:  @code{`pname`} is a procedure.
    944 RETURN:  if @code{fname=\"\"}: string, the proc @code{`pname`} in a verbatim 
     944RETURN:  if @code{fname=\"\"}: string, the proc @code{`pname`} in a verbatim
    945945         environment in LaTeX-typesetting;@*
    946          otherwise: append this string to the file @code{<fname>}, and 
     946         otherwise: append this string to the file @code{<fname>}, and
    947947         return nothing.
    948 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     948NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    949949         (if not given) is added to @code{fname}.@*
    950950         @code{texproc} cannot be applied to itself correctly.
     
    10441044"USAGE:   texring(fname, r[,L]); fname string, r ring, L list
    10451045RETURN:  if @code{fname=\"\"}: string, the ring in TeX-typesetting;@*
    1046          otherwise: append this string to the file @code{<fname>} and 
     1046         otherwise: append this string to the file @code{<fname>} and
    10471047         return nothing.
    10481048NOTE:    preceeding \">>\" are deleted and suffix \".tex\" (if not given)
     
    11771177  texring("",ralg,"mipo");
    11781178  //
    1179   ring r49=(49,a),x,dp;                // Galois field 
     1179  ring r49=(49,a),x,dp;                // Galois field
    11801180  texring("",r49);
    11811181  //
     
    12001200proc rmx(string fname)
    12011201"USAGE:   rmx(fname); fname string
    1202 RETURN:  nothing; removes the @code{.log} and @code{.aux} files associated to 
     1202RETURN:  nothing; removes the @code{.log} and @code{.aux} files associated to
    12031203         the LaTeX file <fname>.@*
    1204 NOTE:    If @code{fname} ends by @code{\".dvi\"} or @code{\".tex\"}, the 
     1204NOTE:    If @code{fname} ends by @code{\".dvi\"} or @code{\".tex\"}, the
    12051205         @code{.dvi} or @code{.tex} file will be deleted, too.
    12061206EXAMPLE: example rmx; shows an example
     
    12861286{ "EXAMPLE:"; echo = 2;
    12871287  intmat m[3][4] = 9,2,4,5,2,5,-2,4,-6,10,-1,2,7;
    1288   opentex("exp001"); 
     1288  opentex("exp001");
    12891289  texobj("exp001","An intmat:  ",m);
    12901290  closetex("exp001");
     
    13001300
    13011301static proc parsr(string s)                     // parse real
    1302 { 
     1302{
    13031303  string t;
    13041304  if (s=="      Inf") { return("\\infty",3);}
     
    13121312    else {return(s[1,5]+"*10^"+t,23);}
    13131313  }
    1314   else 
     1314  else
    13151315  {
    13161316    return(s[1,5],12);
     
    13191319
    13201320static proc parsg(string s)                  // parse Galoisfield
    1321 { 
     1321{
    13221322  int i,j = 1,1;
    13231323  string t;
    13241324  if (short)
    1325   { 
     1325  {
    13261326    t =s[1];
    13271327    if(size(s)>1) {return(t+"^{" + s[2,size(s)-1] + "}",3+2*(size(s)-1));}
     
    13291329  }
    13301330  else
    1331   { 
     1331  {
    13321332    return(parselong(s+"!"));
    13331333  }
     
    13381338"USAGE:   texpoly(fname,p); fname string, p poly
    13391339RETURN:  if @code{fname=\"\"}: string, the poly p in LaTeX-typesetting;@*
    1340          otherwise: append this string to the file @code{<fname>}, and 
     1340         otherwise: append this string to the file @code{<fname>}, and
    13411341         return nothing.
    1342 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     1342NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    13431343         (if not given) is added to @code{fname}.
    13441344EXAMPLE: example texpoly; shows an example
     
    18511851 but looks differently in large parts."+"\\\\" +  nl);
    18521852 write(fname,"\\begin{tabular}{ll}" + nl +
    1853 "LIBRARY: {\\tt latex.lib} &   PROCEDURES FOR TYPESETTING SINGULAR" + 
     1853"LIBRARY: {\\tt latex.lib} &   PROCEDURES FOR TYPESETTING SINGULAR" +
    18541854"\\\\" +  nl +
    18551855" & OBJECTS IN LATEX2E"+
     
    18631863"{\\tt  texdemo([n]);} & produces a file explaining the features of this lib"+
    18641864"\\\\" +  nl +
    1865 "{\\tt  texfactorize(fnm,f);} & creates string in \\LaTeX-format for 
     1865"{\\tt  texfactorize(fnm,f);} & creates string in \\LaTeX-format for
    18661866factors of poly f"+ "\\\\" +  nl +
    18671867"{\\tt  texmap(fnm,m,r1,r2);} & creates string in \\LaTeX-format for
    18681868map m:r1$\\rightarrow$r2"+ "\\\\" +  nl +
    1869 "{\\tt  texname(fnm,s);} &      creates string in \\LaTeX-format for 
     1869"{\\tt  texname(fnm,s);} &      creates string in \\LaTeX-format for
    18701870identifier"+ "\\\\" +  nl +
    18711871"{\\tt  texobj(l);} &           creates string in \\LaTeX-format for
     
    18751875"{\\tt  texproc(fnm,p);} &      creates string in \\LaTeX-format of
    18761876text from proc p"+ "\\\\" +  nl +
    1877 "{\\tt  texring(fnm,r[,l]);} &  creates string in \\LaTeX-lformat for 
     1877"{\\tt  texring(fnm,r[,l]);} &  creates string in \\LaTeX-lformat for
    18781878ring/qring"+ "\\\\" +  nl +
    18791879"{\\tt  rmx(s);} &              removes .aux and .log files of \\LaTeX-files"+
     
    18851885"\\\\" +  nl2 + "\\vspace{0.2cm}" + nl2 +
    18861886"The global variables {\\tt TeXwidth}, {\\tt TeXnofrac}, {\\tt
    1887  TeXbrack}, {\\tt TeXproj}, {\\tt TeXaligned}, {\\tt TeXreplace}, {\\tt 
     1887 TeXbrack}, {\\tt TeXproj}, {\\tt TeXaligned}, {\\tt TeXreplace}, {\\tt
    18881888 NoDollars} are used to control the typesetting: "
    18891889);
     
    19311931
    19321932static proc part1(string fname)
    1933 { 
     1933{
    19341934
    19351935  int st = defined(texdemopart);
     
    19621962"> texring(fname,r0);" +
    19631963ev);
    1964   texring(fname,r0);             
     1964  texring(fname,r0);
    19651965  write(fname,nl2);
    19661966write(fname,
     
    19691969"> texpoly(fname,g);" +nl +
    19701970ev);
    1971   texpoly(fname,g); 
     1971  texpoly(fname,g);
    19721972  write(fname,"\\\\"+nl2);
    19731973
     
    19831983ev
    19841984);
    1985   texpoly(fname,g/280);             
     1985  texpoly(fname,g/280);
    19861986  kill r0;
    1987  
     1987
    19881988write(fname,"\\\\"+nl2);
    19891989write(fname,"\\Line");
    19901990// -2-------- a ring in char 7, indexed varnames and series ordering ----------
    19911991write(fname,
    1992 " A ring in characteristic 7 with indexed names of variables and local 
     1992" A ring in characteristic 7 with indexed names of variables and local
    19931993ordering." +nl);
    19941994 ring r1=7,(x1,x2,x3,x4),Ds;
    1995  poly g=-2*x1+x4-1; 
    1996 write(fname,
    1997 bv +
    1998 "> ring r1=7,(x1,x2,x3,x4),Ds;" +nl +               
     1995 poly g=-2*x1+x4-1;
     1996write(fname,
     1997bv +
     1998"> ring r1=7,(x1,x2,x3,x4),Ds;" +nl +
    19991999"> texring(fname,r1);" +nl +
    20002000ev);
    2001 texring(fname,r1);             
     2001texring(fname,r1);
    20022002write(fname,lb);
    20032003
    20042004write(fname, bv +
    2005 "> poly g=-2*x1+x4-1;  g;" +nl +               
     2005"> poly g=-2*x1+x4-1;  g;" +nl +
    20062006"> texpoly(fname,g);" +nl +
    20072007ev);
    20082008
    20092009  texpoly(fname,g);
    2010  
     2010
    20112011write(fname,lb);
    20122012write(fname,"\\Line");
     
    20142014// -3-------- a ring in char 0, indexed varnames and local ordering ----------
    20152015write(fname,
    2016 " A ring in characteristic 0 with indexed names of variables and local 
     2016" A ring in characteristic 0 with indexed names of variables and local
    20172017ordering.
    20182018" +nl);
     
    20282028  texring(fname,r2);             write(fname,lb);
    20292029  texpoly(fname,g);              write(fname,lb);
    2030  
     2030
    20312031write(fname,"\\Line");
    20322032
     
    20462046  texring(fname,r3);             write(fname,lb);
    20472047  texpoly(fname,g);              write(fname,lb);
    2048  
     2048
    20492049write(fname,"\\Line");
    20502050
     
    22552255 \\verb|\"\\\\C\"|, \\verb|\"k\"|, \\verb|\"K\"|, \\verb|\"R\"|.");
    22562256write(fname,"The latter are useful to print a ring whose field of
    2257 coefficients is defined by an algebraic extension. Now the parameters 
     2257coefficients is defined by an algebraic extension. Now the parameters
    22582258will be omitted completely.
    22592259");
     
    22612261
    22622262write(fname,"Any correct letter in \\LaTeX \\ notation may be used to describe
    2263 the field of coefficients. If the letter is k, K or R it  forces 
    2264 \\verb|texring| not to print the parameters. This will be useful for a 
     2263the field of coefficients. If the letter is k, K or R it  forces
     2264\\verb|texring| not to print the parameters. This will be useful for a
    22652265ring described by an algebraic extension",nl2);
    22662266
     
    23532353
    23542354static proc part2(string fname)
    2355 { 
     2355{
    23562356
    23572357  int st = defined(texdemopart);
     
    24742474
    24752475TeXreplace[4] = list("x","\\tilde{y}");
    2476  
     2476
    24772477// setring r1;
    24782478  ring r1=7,(x1,x2,x3,x4),Ds;
    2479   poly g=-2*x1+x4-1; 
     2479  poly g=-2*x1+x4-1;
    24802480
    24812481write(fname,
     
    25432543ev);
    25442544
    2545   setring r0; 
     2545  setring r0;
    25462546  poly g=-x2y+2y13z+1;
    25472547  poly f = g^2;
     
    27412741
    27422742static proc part3(string fname)
    2743 { 
     2743{
    27442744  int st = defined(texdemopart);
    27452745  string nl = newline;
     
    27502750
    27512751  if (not(st) or st>=3)
    2752   { 
     2752  {
    27532753    print(" Call part2 first");
    27542754    return();
     
    27672767> texmap(fname,phi,r4,r5,\"\\\\C\");" + nl +
    27682768ev );
    2769  
     2769
    27702770  ring @r4_h=0,(x,y,z),dp;
    27712771  if(system("with","Namespaces")) { exportto(Current, @r4_h); }
     
    28352835 intvec v = 2;
    28362836 texmap(fname,"@phi_h",@r4_h,r5,list(),list(v,"{"));
    2837  
     2837
    28382838 kill v,@phi_h,@r4_h,r5,TeXreplace,TeXaligned;
    28392839
     
    29492949ev );
    29502950
    2951   setring r; 
     2951  setring r;
    29522952  ideal I = 3xz5+x2y3-3z,7xz5+y3z+x-z,-xyz2+4yz+2x;
    29532953  int TeXproj; export TeXproj;
    2954  
     2954
    29552955  texobj(fname,V);
    29562956  kill TeXproj;
     
    30893089      "// not an isolated singularity";
    30903090    }
    3091     return(m_nr); 
     3091    return(m_nr);
    30923092  }
    30933093  export(milnor_number);
    3094  
     3094
    30953095
    30963096write(fname,"\\section{procs}");
    3097 write(fname,"Finally, here is a way to typeset procedures in \\LaTeX :"); 
    3098  
     3097write(fname,"Finally, here is a way to typeset procedures in \\LaTeX :");
     3098
    30993099  texproc(fname,"milnor_number");
    31003100
    31013101  kill(milnor_number);
    3102  
     3102
    31033103// ------------------------------ closing the tex file -------------------
    31043104write(fname,"\\section{Closing the \\LaTeX\\ file}");
Note: See TracChangeset for help on using the changeset viewer.