Changeset 917fb5 in git for Singular/LIB/latex.lib


Ignore:
Timestamp:
Jul 6, 1999, 5:33:00 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
8e7ed6b81b8840e62d72f281eef096b71dc1b37e
Parents:
ce7ba606241efb95de4d1ab5581428b7143b3be2
Message:
* hannes: removed pause; (scanner.l, febase.*)
          introduced pause([string]) (standard.lib)


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/latex.lib

    rce7ba6 r917fb5  
    1 // $Id: latex.lib,v 1.7 1999-07-06 11:33:00 obachman Exp $   
     1// $Id: latex.lib,v 1.8 1999-07-06 15:32:52 Singular Exp $
    22//                        1998/04/17
    33// author : Christian Gorzel email: gorzelc@math.uni-muenster.de
    4 // 
     4//
    55///////////////////////////////////////////////////////////////////////////////
    66
     
    2626 xdvi(s);             calls xdvi for dvi-file s
    2727         (parameters in square brackets [] are optional)
    28  
    29 GLOBAL VARIABLES: 
     28
     29GLOBAL VARIABLES:
    3030  TeXwidth, TeXnofrac, TeXbrack, TeXproj, TeXaligned, TeXreplace, NoDollars
    31                   are used to control the typesetting 
     31                  are used to control the typesetting
    3232    Call example texdemo; to become familiar with the features of latex.lib
    3333
     
    4545///////////////////////////////////////////////////////////////////////////////
    4646
    47 proc closetex(string fname, list #) 
     47proc closetex(string fname, list #)
    4848"USAGE:   closetex(fname[,style]); fname,style = string
    4949RETURN:  nothing; writes a LaTeX2e closing line into file fname
    50 NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex 
    51          preceeding >> end ending \".tex\" may miss in fname; 
     50NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex
     51         preceeding >> end ending \".tex\" may miss in fname;
    5252         overwriting an existing file is not possible
    5353EXAMPLE: example closetex; shows an example
    5454"
    5555{
    56   string default = "latex2e";   
     56  string default = "latex2e";
    5757  string s;
    5858  int i = 1;
     
    6161  if (size(#)) { default = #[1];}
    6262
    63   if (default=="latex2e" or default == "latex") 
     63  if (default=="latex2e" or default == "latex")
    6464   {  s = "\\end{document}"; flag = 1;}
    6565  if (default=="amstex") {s = "\\enddocument"; flag = 1;}
    6666  if (default=="tex") {s = "\\bye"; flag = 1;}
    67   if (not(flag)) { s = "";} 
    68 
    69   if (size(fname))                     
     67  if (not(flag)) { s = "";}
     68
     69  if (size(fname))
    7070  {
    7171   while (fname[i]==">"){i++;}
    7272   fname = fname[i,size(fname)-i+1];
    73  
     73
    7474   if (size(fname)>=4)               // check if filename is ending with ".tex"
    7575   { if(fname[size(fname)-3,4]!=".tex") {fname = fname +".tex"; }
     
    7777   else {fname = fname + ".tex";}
    7878   write(fname, s);
    79    write(fname," - Thanks latex.lib and Singular - "); 
    80   }
    81   else {return(s);} 
     79   write(fname," - Thanks latex.lib and Singular - ");
     80  }
     81  else {return(s);}
    8282}
    8383example
     
    9292"USAGE:   tex(fname[,style]); fname,style = string
    9393RETURN:  nothing; calls latex2e for compiling the file fname
    94 NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex 
    95          ending ".tex" may miss in fname       
     94NOTE:    style overwrites the default setting latex2e; maybe latex,amstex,tex
     95         ending ".tex" may miss in fname
    9696EXAMPLE: example tex; shows an example
    9797"
    98 { 
     98{
    9999  string default = "latex2e";
    100   int retval;         
     100  int retval;
    101101  int i=1;
    102102
     
    107107   while (fname[i]==">"){i++;}
    108108   fname = fname[i,size(fname)-i+1];
    109  
     109
    110110   if (size(fname)>=4)               // check if filename is ending with ".tex"
    111111   { if(fname[size(fname)-3,4]!=".tex") {fname = fname +".tex"; }
     
    113113   else {fname = fname + ".tex";}
    114114   "calling ",default, " for :",fname,newline;
    115  
     115
    116116   retval = system("sh",default + " " +  fname);
    117117  }
     
    135135  tex("exp002","tex");
    136136  echo = 0;
    137   print("the created files will be deleted after pressing <RETURN> ");
    138   pause;
     137  pause("the created files will be deleted after pressing <RETURN>");
    139138  echo = 2;
    140139  system("sh","rm -i exp00?.*");
     
    142141///////////////////////////////////////////////////////////////////////////////
    143142
    144 proc opentex(string fname, list #)         
     143proc opentex(string fname, list #)
    145144"USAGE:   opentex(fname[,style]); fname,style = string
    146145RETURN:  nothing; writes as LaTeX2e header into a new file fname
    147146NOTE:    suffix .tex may miss in fname
    148          style overwrites the default setting latex2e; may be latex,amstex,tex 
     147         style overwrites the default setting latex2e; may be latex,amstex,tex
    149148EXAMPLE: example opentex; shows an example
    150149"
    151 { 
     150{
    152151  string default = "latex2e";
    153152  string s;
     
    157156  if (size(#)) { default = #[1];}
    158157
    159   if (default == "latex2e")          // the default  latex2e header 
    160   { s =     
     158  if (default == "latex2e")          // the default  latex2e header
     159  { s =
    161160      "\\documentclass[12pt]{article}" + newline +
    162161   //   "\\usepackage{fullpage,amsmath,amscd,amsthm,amssymb,amsxtra,latexsym,epsfig}" + newline +
    163162      "\\usepackage{amsmath,amssymb}" + newline +
    164       "\\parindent=0pt" + newline + 
    165       "\\newcommand{\\C}{{\\Bbb C}}" + newline + 
    166       "\\newcommand{\\F}{{\\Bbb F}}" + newline + 
     163      "\\parindent=0pt" + newline +
     164      "\\newcommand{\\C}{{\\Bbb C}}" + newline +
     165      "\\newcommand{\\F}{{\\Bbb F}}" + newline +
    167166      "\\newcommand{\\N}{{\\Bbb N}}" + newline +
    168167   // "\\newcommand{\\P}{{\\Bbb P}}" + newline +
    169       "\\newcommand{\\Q}{{\\Bbb Q}}" + newline + 
     168      "\\newcommand{\\Q}{{\\Bbb Q}}" + newline +
    170169      "\\newcommand{\\R}{{\\Bbb R}}" + newline +
    171170      "\\newcommand{\\T}{{\\Bbb T}}" + newline +
     
    175174  }
    176175  if (default == "latex")
    177   { s =     
     176  { s =
    178177      "\\documentstyle[12pt,amstex]{article}" + newline +
    179178      "\\parindent=0pt" + newline +
    180       "\\newcommand{\\C}{{\\Bbb C}}" + newline + 
    181       "\\newcommand{\\F}{{\\Bbb F}}" + newline + 
     179      "\\newcommand{\\C}{{\\Bbb C}}" + newline +
     180      "\\newcommand{\\F}{{\\Bbb F}}" + newline +
    182181      "\\newcommand{\\N}{{\\Bbb N}}" + newline +
    183182   // "\\newcommand{\\P}{{\\Bbb P}}" + newline +
    184       "\\newcommand{\\Q}{{\\Bbb Q}}" + newline + 
     183      "\\newcommand{\\Q}{{\\Bbb Q}}" + newline +
    185184      "\\newcommand{\\R}{{\\Bbb R}}" + newline +
    186185      "\\newcommand{\\T}{{\\Bbb T}}" + newline +
     
    188187      "\\begin{document}";
    189188    flag = 1;
    190   } 
    191   if (default == "amstex") 
    192   { s = 
     189  }
     190  if (default == "amstex")
     191  { s =
    193192     "\\documentstyle{amsppt} " + newline + newline +
    194193     "\\document";
    195     flag = 1; 
    196   }
    197 
    198   if (default == "tex") 
    199   { s = 
    200      ""; 
     194    flag = 1;
     195  }
     196
     197  if (default == "tex")
     198  { s =
     199     "";
    201200    flag = 1;
    202201  }
     
    207206  if (not(flag)) { s = "";}
    208207
    209   if (size(fname))                     
     208  if (size(fname))
    210209  {
    211210   while (fname[i]==">"){i++;}
     
    219218   write(fname,s);
    220219  }
    221   else {return(s);}   
     220  else {return(s);}
    222221}
    223222example
     
    229228///////////////////////////////////////////////////////////////////////////////
    230229
    231 proc texdemo(list #) 
     230proc texdemo(list #)
    232231"USAGE:   texdemo();
    233232RETURN:  nothing; generates automatically a LaTeX2e file called: texlibdemo.tex
    234233         explaining the  features of latex.lib and its gloabl variables
    235 NOTE:    this proc takes a minutes         
     234NOTE:    this proc takes a minutes
    236235EXAMPLE: example texdemo; executes the generation
    237236"
     
    239238  string fname = "texlibdemo";
    240239
    241   if (size(#)) 
    242   { if (typeof(#[1])=="int") {TeXdemostart = #[1];} 
     240  if (size(#))
     241  { if (typeof(#[1])=="int") {TeXdemostart = #[1];}
    243242  }
    244243  system("random",TeXdemostart);
    245  
     244
    246245  if (size(#) ==2)
    247246  { if (typeof(#[2]) == "string") { fname = #[2];}
     
    274273///////////////////////////////////////////////////////////////////////////////
    275274
    276 proc texfactorize(string fname, poly f, list #) 
     275proc texfactorize(string fname, poly f, list #)
    277276"USAGE:   opentex(fname,f); fname = string; f = poly
    278277RETURN:  string, the poly as as product of its irreducible factors
    279278                 in TeX-typesetting if fname == empty string;
    280          otherwise append this to file fname.tex; return nothing 
    281 NOTE:    preceeding >> end ending \".tex\" may miss in fname 
     279         otherwise append this to file fname.tex; return nothing
     280NOTE:    preceeding >> end ending \".tex\" may miss in fname
    282281EXAMPLE: example texfactorize; shows an example
    283282"
     
    295294  else { D = ""; }
    296295  TW = defined(TeXwidth);
    297   if (TW) {Tw = TeXwidth; TeXwidth = -1;} 
     296  if (TW) {Tw = TeXwidth; TeXwidth = -1;}
    298297  else {int TeXwidth = -1; export TeXwidth;}
    299298
     
    312311    if(size(g)>1 or (size(g)==1 and k>1))
    313312    { t = "(" + texpoly("",l[1][i]) + ")";}
    314     else { t =  texpoly("",l[1][i]);} 
     313    else { t =  texpoly("",l[1][i]);}
    315314    if (l[2][i]>1)
    316315    { t = t+"^{" +string(l[2][i]) + "}";}
     
    321320   if (TW) {TeXwidth = Tw;}
    322321  }
    323   if(size(fname)) 
     322  if(size(fname))
    324323  { i=1;
    325324    while (fname[i]==">"){i++;}
     
    342341  minpoly = a2 +a +3;
    343342  poly f = (a24x5 + x3)*a2x6*(x+1)^2;
    344   f; 
     343  f;
    345344  texfactorize("",f);
    346345}
     
    351350RETURN:  string, the map m from @r1 to @r2 preeceded by its name if m = string
    352351                 in TeX-typesetting if fname == empty string;
    353          otherwise append this to file fname.tex; return nothing 
    354 NOTE:    preceeding >> end ending \".tex\" may miss in fname 
     352         otherwise append this to file fname.tex; return nothing
     353NOTE:    preceeding >> end ending \".tex\" may miss in fname
    355354EXAMPLE: example texmap; shows an example
    356355"
    357 { 
     356{
    358357  int saveDollars= defined(NoDollars);
    359358  int TX = defined(TeXwidth);
     
    371370  { int i;
    372371
    373     for(i=1;i<=size(TeXreplace);i++) 
     372    for(i=1;i<=size(TeXreplace);i++)
    374373    { if (TeXreplace[i][1]==s) {s= TeXreplace[i][2]; break;}}
    375374    return(s);
    376375  }
    377  
     376
    378377// --- store all actual informations
    379378  if(TX) { Tw = TeXwidth; TeXwidth = -1;}
     
    429428  t = t + texpoly("",@J[1]);
    430429  for (i=2;i<=n; i++)
    431   {if(defined(TeXaligned)) 
     430  {if(defined(TeXaligned))
    432431   { t = t + vrg + texpoly("",@J[i]); }
    433432   else { t = t + "\\\\" + newline + texpoly("",@J[i]);}
     
    479478  else {return(s);}
    480479}
    481 example 
     480example
    482481{ "EXAMPLE:"; echo = 2;
    483482  string fname = "tldemo";
     
    494493  texmap("",phi,r1,r2,"\\C");
    495494  kill r1,r2,TeXreplace,TeXaligned;
    496 }       
     495}
    497496///////////////////////////////////////////////////////////////////////////////
    498497
    499 proc texname(string fname, string s) 
     498proc texname(string fname, string s)
    500499"USAGE:   texname(fname,s);  fname,s = string
    501500RETURN:  the string s if fname == the empty string
    502          otherwise append s to file fname.tex; return nothing 
    503 NOTE:    preceeding >> end ending \".tex\" may miss in fname         
     501         otherwise append s to file fname.tex; return nothing
     502NOTE:    preceeding >> end ending \".tex\" may miss in fname
    504503EXAMPLE: example texname; shows an example
    505504"
     
    528527  if (s[i]=="[") { anf = i+1;
    529528   while(s[i]!="]"){i++;}                    // matrices and vectors
    530     st = st + "_{" + s[anf,i-anf] + "}"; n = n+ 5*(i-anf); i++; 
     529    st = st + "_{" + s[anf,i-anf] + "}"; n = n+ 5*(i-anf); i++;
    531530  // besser: while s[i]<> nwline : scan forward: end, return
    532531  }
     
    538537  n = n+5*(i-anf);
    539538  anf =i;            // the next text in ( , ) as exponent
    540   if (op) { if (s[i]== ","){anf = anf+1;}             
     539  if (op) { if (s[i]== ","){anf = anf+1;}
    541540   while(s[i] !=")"){ i++;}
    542541   if (i<>anf){st = st + "^{" + s[anf,i-anf] + "}"; n = n +5*(i-anf);}
     
    577576"USAGE:   texobj(fname,l); fname = string,l = list of Singular dataypes
    578577RETURN:  string, the objects in TeX-typesetting if fname == empty string;
    579          otherwise append this to file fname.tex; return nothing   
    580 NOTE:    preceeding ">>" end ending ".tex" may miss in fname;         
     578         otherwise append this to file fname.tex; return nothing
     579NOTE:    preceeding ">>" end ending ".tex" may miss in fname;
    581580EXAMPLE: example texobj; shows an example
    582581"
     
    591590 string D,DA,DE = "$","\\begin{equation*}" + newline,
    592591                     "\\end{equation*}"+ newline;
    593  string OB,CB = "(",")"; 
     592 string OB,CB = "(",")";
    594593 if (defined(TeXbrack))
    595594 {// if (TeXbrack=="(") {OB = "("; CB = ")";}
     
    610609 proc absterm(poly f)
    611610 { int k;
    612    
     611
    613612   for (k=1; k<=nvars(basering); k++)
    614613   { f = subst(f,var(k),0); }
     
    618617
    619618 if (size(#)==1)
    620  { if (typeof(#[1])=="int" or typeof(#[1])=="intvec" or typeof(#[1])=="vector" 
     619 { if (typeof(#[1])=="int" or typeof(#[1])=="intvec" or typeof(#[1])=="vector"
    621620   or typeof(#[1])=="number" or defined(TeXaligned)) { DA = D; DE = D; } }
    622621
     
    625624 for (k=1; k<=size(#); k++)
    626625 { def obj = #[k];
    627    if (typeof(obj) == "string") 
     626   if (typeof(obj) == "string")
    628627   { if (defined(`obj`))
    629      { if (typeof(`obj`)=="ideal") 
     628     { if (typeof(`obj`)=="ideal")
    630629       { Iname = obj; def e = `obj`;
    631630         kill obj; def obj = e; kill e;}
     
    635634   }
    636635   if (typeof(obj) == "int") { s = s + "  " + string(obj) + "  ";}
    637  
    638    if (typeof(obj) == "intvec") 
     636
     637   if (typeof(obj) == "intvec")
    639638   { s = s + "  (";
    640639     for(j=1; j<size(obj);j++) { s = s + string(obj[j]) + sep;}
     
    642641   }
    643642
    644    if (typeof(obj) == "number" ) 
     643   if (typeof(obj) == "number" )
    645644   { s = s + texpoly("",obj) + newline;
    646645   }
     
    654653   }
    655654
    656    if (typeof(obj) == "vector") 
     655   if (typeof(obj) == "vector")
    657656   { if (obj==0) { s = s  + "0" ;}
    658657     else
     
    665664    }
    666665
    667    if (typeof(obj) == "ideal") 
     666   if (typeof(obj) == "ideal")
    668667   { if (size(Iname))   // verwende hier align
    669668     { if (Tw==0) {TeXwidth = -1;}
     
    673672      //  { untereinander }
    674673      // else { hintereinander }
    675       // 
    676       // 
    677       //  s = s + Iname + "=" + texpoly("",obj,","); 
     674      //
     675      //
     676      //  s = s + Iname + "=" + texpoly("",obj,",");
    678677      //  siehe ebenso noch einmal am Ende : ! (TeXwidth <> 0 !? )
    679678
    680679       s =  s + "\\begin{array}{rcl}" + newline;
    681680       for (i=1;i<=size(matrix(obj));i++)
    682        { s =  s + Iname+ "_{" + string(i) + "} & = & " 
     681       { s =  s + Iname+ "_{" + string(i) + "} & = & "
    683682               + texpoly("",obj[i]);
    684683         if (i<size(matrix(obj))){ s = s  + "\\\\" + newline;}
     
    689688       Iname ="";
    690689     }
    691      else 
    692      { 
    693       if (TeXwidth==0) 
     690     else
     691     {
     692      if (TeXwidth==0)
    694693      { TeXwidth = -1;
    695694        obj= simplify(obj,2);
     
    711710        }
    712711        else   // linear
    713         { s = s + 
     712        { s = s +
    714713   "\\begin{array}{*{" + string(2*nvars(basering)-1) + "}{c}cr}" + newline;
    715            for(j=1; j<=size(obj);j++) 
    716            { h = absterm(obj[j]); 
     714           for(j=1; j<=size(obj);j++)
     715           { h = absterm(obj[j]);
    717716             ineq = attrib(obj[j],"ineq");
    718717             if(!(size(ineq))) { ineq = "=" ; }
     
    725724                { if (t[1]!="-" and t[1]!= " " and nc ){sg = "+";}
    726725                  if  (t[1]=="-") { sg = "-"; nc =1; t=t[2,size(t)-1];}
    727                   if (t==" ") {sg ="";} 
     726                  if (t==" ") {sg ="";}
    728727                  l = l + " & " + sg + " & " + t;
    729728                }
     
    744743     if (defined(TeXaligned))
    745744     { s = s + texpoly("",obj,",");
    746      } 
     745     }
    747746     else
    748747     { s = s + newline + "\\begin{array}{c}" + newline +
    749                texpoly("",obj,", \\\\" + newline) + 
     748               texpoly("",obj,", \\\\" + newline) +
    750749                newline + "\\end{array}" + newline;
    751750     }
    752751    s = s + "\\right" + CB;
    753     } // end TeXwidth <> 0 
     752    } // end TeXwidth <> 0
    754753   }  // not Iname
    755754// s;
    756755  }
    757756
    758    if (typeof(obj) == "module") 
     757   if (typeof(obj) == "module")
    759758   { M = matrix(obj);
    760759     if (Tw ==0 or Tw > 9) { TeXwidth = -1;}
     
    762761     if (!(defined(TeXaligned)))
    763762     {  // Naechste Zeile nicht notwendig !
    764      // s = s + "\\begin{array}{*{"+ string(ncols(M)) + "}{c}}" + newline; 
    765       for(j=1;j<=ncols(M);j++) 
     763     // s = s + "\\begin{array}{*{"+ string(ncols(M)) + "}{c}}" + newline;
     764      for(j=1;j<=ncols(M);j++)
    766765      { l = "\\left" + OB + newline + "\\begin{array}{c}" + newline;
    767766        l = l + texpoly("",ideal(M[1..nrows(M),j]), " \\\\" + newline)
     
    772771     }
    773772     else    // TeXaligned
    774      { 
    775       for(j=1;j<=ncols(M);j++) 
     773     {
     774      for(j=1;j<=ncols(M);j++)
    776775      { s = s + "\\left" + OB + newline +
    777776           texpoly("",ideal(M[1..nrows(M),j]),",") + newline + "\\right" + CB;
     
    787786     l = "";
    788787   //  M = transpose(obj);
    789      s = s + "\\left" + OB + newline + 
     788     s = s + "\\left" + OB + newline +
    790789             "\\begin{array}{*{"+ string(ncols(obj)) + "}{c}" + "}"+ newline;
    791790     for(i=1;i<=nrows(obj);i++)
     
    794793     }
    795794     l = l + newline;
    796      s = s + l + "\\end{array}" + newline + 
     795     s = s + l + "\\end{array}" + newline +
    797796                 "\\right" + CB + newline;
    798797    TeXwidth = Tw;
    799798  }
    800  
     799
    801800   if (typeof(obj) == "intmat")
    802801   { nr,nc = nrows(obj),ncols(obj);
    803802     l = "";
    804      l =  "\\left" + OB + newline + 
     803     l =  "\\left" + OB + newline +
    805804          "\\begin{array}{*{"+ string(nc) + "}{r}}"+ newline;
    806805     for(i=1;i<=nr;i++)
    807      { for(j=1;j<=nc;j++) 
     806     { for(j=1;j<=nc;j++)
    808807       { l = l + string(obj[i,j]);
    809808         if (j <nc ) { l = l + " & ";}
     
    811810       }
    812811     }
    813      l = l + newline + "\\end{array}" + newline + 
     812     l = l + newline + "\\end{array}" + newline +
    814813             "\\right" + CB + newline;
    815     s = s + l; 
     814    s = s + l;
    816815  }
    817816
     
    854853///////////////////////////////////////////////////////////////////////////////
    855854
    856 proc texproc(string fname,string pname) 
     855proc texproc(string fname,string pname)
    857856"USAGE:   opentex(fname,pname); fname,pname = string
    858 RETURN:  string, the proc in a verbatim environment in TeX-typesetting 
     857RETURN:  string, the proc in a verbatim environment in TeX-typesetting
    859858                 if fname == empty string;
    860          otherwise append this to file fname.tex; return nothing 
    861 NOTE:    preceeding >> end ending \".tex\" may miss in fname; 
    862 CAUTION: texproc cannot applied on itself correctly         
     859         otherwise append this to file fname.tex; return nothing
     860NOTE:    preceeding >> end ending \".tex\" may miss in fname;
     861CAUTION: texproc cannot applied on itself correctly
    863862EXAMPLE: example texproc; shows an example
    864863"
     
    900899    { if(fname[size(fname)-3,4]!=".tex") {fname = fname +".tex"; }
    901900    }
    902     else {fname = fname + ".tex";} 
     901    else {fname = fname + ".tex";}
    903902    write(fname,s);
    904903  }
    905   else{return(s);}     
     904  else{return(s);}
    906905}
    907906example
     
    918917  }
    919918  export exp;
    920   texproc("","exp"); 
     919  texproc("","exp");
    921920}
    922921
    923922///////////////////////////////////////////////////////////////////////////////
    924923
    925 proc texring(string fname, def r, list #) 
     924proc texring(string fname, def r, list #)
    926925"USAGE:   texring(fname, r[,l]); fname = string; r = ring;
    927926         l=list of strings : controls the symbol for
    928          coefficient field etc. see example texdemo(); 
     927         coefficient field etc. see example texdemo();
    929928RETURN:  string, the ring in TeX-typesetting if fname == empty string;
    930          otherwise append this to file fname.tex; return nothing   
    931 NOTE:    preceeding >> end ending \".tex\" may miss in fname;       
     929         otherwise append this to file fname.tex; return nothing
     930NOTE:    preceeding >> end ending \".tex\" may miss in fname;
    932931EXAMPLE: example texring; shows an example
    933932"
    934 { 
     933{
    935934  int i,galT,flag,mipo,nopar,Dollars,TB,TA;
    936935  string ob,cb,cf,en,s,t,savebrack; //opening bracket, closing br, coef.field
     
    939938
    940939  proc tvar(intvec v)
    941   { 
     940  {
    942941    int i,j,ldots;
    943942    string s;
    944    
     943
    945944    j = 1;
    946945    s = texpoly("",var(1));
    947    
     946
    948947    if (nvars(basering)==1) { return(s);}
    949948    if (nvars(basering)==2) { return(s + "," + texpoly("",var(2)));}
     
    957956        ldots =1;
    958957      }
    959       if (i== v[j]) 
     958      if (i== v[j])
    960959      { s = s + "," + texpoly("",var(i));
    961960        ldots =0;
     
    986985  if (size(#))
    987986  { if (typeof(#[1])=="list") { # = #[1];}
    988   } 
     987  }
    989988  for (i=1;i<=size(#);i++)
    990989  { flag =0;
     
    10181017   s = s + texpoly("",par(npars(r))) + ")";
    10191018  }                               // parameters done
    1020   if (!(galT) and mipo and minpoly!=0) 
     1019  if (!(galT) and mipo and minpoly!=0)
    10211020  { s = s + "/" + list(parsp(string(minpoly),0))[1];}
    10221021  s = s + ob;
     
    10291028  if (typeof(r)=="qring")
    10301029  { ideal @I = ideal(r);
    1031     if (defined(TeXbrack)) 
     1030    if (defined(TeXbrack))
    10321031    {
    1033       TB =1; savebrack = TeXbrack; 
     1032      TB =1; savebrack = TeXbrack;
    10341033      if (TeXbrack!= "<" and TeXbrack!="(") { TeXbrack = "<";}
    10351034    }
     
    10441043  }
    10451044
    1046   if (Dollars) 
     1045  if (Dollars)
    10471046  { kill NoDollars;
    10481047    s =  "$" + s + "$";
     
    10601059  }
    10611060  else{return(s);}
    1062 } 
     1061}
    10631062example
    10641063{ "EXAMPLE:"; echo=2;
    10651064  ring r0 = 0,(x,y,z),dp;       // short varnames polynomial ordering
    10661065  texring("",r0);
    1067   ring r7 =0,(x(0..2)),ds;      // char =7, long varnames 
     1066  ring r7 =0,(x(0..2)),ds;      // char =7, long varnames
    10681067  texring("",r7);
    10691068  ring r1 = 0,(x1,x2,y1,y2),wp(1,2,3,4);
     
    10741073  texring("",rr);
    10751074  ring r;
    1076   texring("",r); 
     1075  texring("",r);
    10771076  ring rabc =(0,t1,t2,t3),(x,y),dp;  // parameters
    10781077  texring("",rabc);
     
    10821081  texring("",ralg,"mipo");
    10831082  ring r49=(49,a),x,dp;              // Galoisfield
    1084   texring("",r49); 
     1083  texring("",r49);
    10851084  setring r0;
    10861085  ideal i = x2-z,xy2+1;
     
    10941093  intvec v = 5,6;
    10951094  texring("",rxy,v);
    1096   texring("",r0,"C","{"); 
     1095  texring("",r0,"C","{");
    10971096  texring("",ralg,"k");
    10981097  texring("",r7,"^G");
     
    11101109proc rmx(string fname)
    11111110"USAGE:   rmx(fname); fname = string
    1112 RETURN:  nothing; removes .log and .aux files associated to file <fname>     
     1111RETURN:  nothing; removes .log and .aux files associated to file <fname>
    11131112         removes tex and xdvi file too, if suffix \".tex\" or \".dvi\" is given
    1114 NOTE:    if fname ends by .dvi or .tex 
    1115          fname.dvi or fname.dvi and fname.tex will be deleted, too           
     1113NOTE:    if fname ends by .dvi or .tex
     1114         fname.dvi or fname.dvi and fname.tex will be deleted, too
    11161115EXAMPLE: example rmx; shows an example
    11171116"
    11181117{
    11191118  int i,suffix= 1,0;
    1120   int retval; 
     1119  int retval;
    11211120
    11221121  if (size(fname))
     
    11281127     if (fname[size(fname)-3,4]==".dvi") { suffix = 1; }
    11291128     if (suffix) { fname = fname[1,size(fname)-4]; }
    1130    } 
     1129   }
    11311130   retval = system("sh","rm " + fname + ".aux");
    11321131   retval = system("sh","rm " + fname + ".log");
     
    11371136  {" -- Need a filename ";
    11381137    return();
    1139   } 
     1138  }
    11401139}
    11411140example
     
    11551154  rmx("exp002.tex");  // removes aux, log, dvi and tex file of exp002
    11561155  echo = 0;
    1157   print("remaining files will be deleted after pressing <RETURN> ");
    1158   pause;
     1156  pause("remaining files will be deleted after pressing <RETURN>");
    11591157  echo = 2;
    11601158  system("sh","rm -i exp00?.*");
     
    11721170  int i=1;
    11731171  int retval;
    1174   string default = "xdvi"; 
    1175  
     1172  string default = "xdvi";
     1173
    11761174  if (size(#)) {default = string(#[1]);}
    1177  
     1175
    11781176  if (size(fname))
    11791177  {
     
    11831181   if (size(fname)>=4)
    11841182   { if(fname[size(fname)-3,4]==".tex") {fname = fname[1,size(fname)-4];}}
    1185  
    1186    "calling ",default, " for :",fname,newline; 
    1187  
     1183
     1184   "calling ",default, " for :",fname,newline;
     1185
    11881186   retval = system("sh",default + " " +  fname + " &");
    11891187  }
     
    12031201  xdvi("exp001");
    12041202  echo = 0;
    1205   print("the created files will be deleted after pressing <RETURN> ");
    1206   pause;
     1203  pause("the created files will be deleted after pressing <RETURN>");
    12071204  echo = 2;
    1208   system("sh","rm -i exp00?.*"); 
     1205  system("sh","rm -i exp00?.*");
    12091206}
    12101207///////////////////////////////////////////////////////////////////////////////
     
    12131210"USAGE:   texpoly(fname,p[,l]); fname = string; p = poly,ideal; l formation str
    12141211RETURN:  string, the objects in TeX-typesetting if fname == empty string;
    1215          otherwise append this to file fname.tex; return nothing   
    1216 NOTE:    preceeding ">>" end ending ".tex" may miss in fname;     
     1212         otherwise append this to file fname.tex; return nothing
     1213NOTE:    preceeding ">>" end ending ".tex" may miss in fname;
    12171214EXAMPLE: example texpoly; shows an example
    12181215"
    1219 { 
     1216{
    12201217  def @r = basering;
    12211218
     
    12251222  string sign,cfmt,pt,s,bg,t,monomt,  lnbreak;
    12261223  string sep = newline;
    1227   int i,b,b2,n, msz,linesz, count,k; 
     1224  int i,b,b2,n, msz,linesz, count,k;
    12281225  int realT, parT, galT;
    12291226  int C = 2 + defined(TeXdisplay);
     
    12341231  if (typeof(p)  == "ring" or typeof(p) == "qring")
    12351232  { " -- Call  texring  instead "; return();}
    1236   if (find(notvalid,typeof(p))) 
     1233  if (find(notvalid,typeof(p)))
    12371234  { " -- Call  texobj  instead "; return();}
    12381235  if (typeof(p)  == "map")
     
    12471244
    12481245  proc parsr(string s)                     // parse real
    1249   { string t; 
    1250                              
    1251     if (s=="      Inf") { return("\\infty",3);}   
     1246  { string t;
     1247
     1248    if (s=="      Inf") { return("\\infty",3);}
    12521249    if (s=="     -Inf") { return("\\-infty",6);}
    12531250    if (s[7]=="-"){t ="-";}
    12541251    if (s[8]<>"0"){t = t + s[8];}
    12551252    if (s[9]<>"0" or s[8]<>"0"){t = t + s[9];}
    1256     if (size(t)) 
     1253    if (size(t))
    12571254    { if (t=="1") {return(s[1,5]+"*10",21);}
    12581255      if (size(t)>1) {return(s[1,5]+"*10^{"+t+"}",21+2*size(t));}
     
    12651262  { int i,j = 1,1;
    12661263    string t;
    1267    
     1264
    12681265    if (short)
    1269     { t =s[1]; 
     1266    { t =s[1];
    12701267     if(size(s)>1) {return(t+"^{" + s[2,size(s)-1] + "}",3+2*(size(s)-1));}
    1271      else{return(t,5);}     
     1268     else{return(t,5);}
    12721269    }
    12731270    else
    12741271    { return(parselong(s+"!"));}
    12751272  }
    1276  
     1273
    12771274  if (defined(TeXdisplay)) { bg = "& ";}
    12781275  if (!(defined(TeXwidth))) { int TeXwidth = -1; export TeXwidth;}
     
    12801277
    12811278// -- Type check
    1282  
     1279
    12831280 if (typeof(p)=="string")
    12841281  { if(defined(`p`))
    1285     { pt = p + " = "; 
    1286       p = `p`; 
     1282    { pt = p + " = ";
     1283      p = `p`;
    12871284    }
    12881285  }
    12891286  if (typeof(p)=="poly" or typeof(p)=="number") {I = p;}
    1290  
    1291   if (typeof(p)=="ideal") 
     1287
     1288  if (typeof(p)=="ideal")
    12921289  { I = p;
    12931290    if(size(#)){ sep = #[1];}
    12941291  }
    12951292
    1296   if (I==0) 
     1293  if (I==0)
    12971294  { if (!(defined(NoDollars))){return("$0$");}
    12981295    else {return("0");}
    12991296  }
    13001297
    1301 // -- Type check ende 
    1302 
    1303 //--------------------- 
     1298// -- Type check ende
     1299
     1300//---------------------
    13041301
    13051302
    13061303//------- set flags: --------------------------------------------------------
    1307    
     1304
    13081305  if (size(#))
    13091306  { if (typeof(#[1])=="int") { linesz = #[1];}
     
    13171314  { t = charstr(@r)[1,i-1];
    13181315    galT = (t <> string(char(@r)));  // the char is not the same as the ...
    1319   } 
     1316  }
    13201317  i = 0;
    1321  
     1318
    13221319//------- parse the polynom
    13231320  pt = bg;
    1324  
     1321
    13251322 for(k=1;k<=size(matrix(I));k++)
    13261323 { i = 0; linesz = 0; count =0;
    1327    sign =""; 
     1324   sign ="";
    13281325   f = I[k];
    13291326   if (f==0) { pt = pt + "0";}
     
    13321329
    13331330// ------ tex the coefficient
    1334     monom = lead(f);   
    1335     f = f - monom;       
     1331    monom = lead(f);
     1332    f = f - monom;
    13361333    cfm = leadcoef(monom);
    13371334    if (cfm*1 != 0) { monom = monom/cfm;} // the normalized monom
    13381335    s = string(monom) + "!";              // add a terminating sign
    13391336    cfmt = "";
    1340    
     1337
    13411338    if (defined(TeXreplace)) { short =0;}  // this is essential
    13421339    cfmt = string(cfm);
     
    13621359     if (b) {b++;}
    13631360     n = size(cfmt);
    1364      if (!(parT) and  !(realT) and !(galT))   
    1365      { if( !(b2) or defined(TeXnofrac)) 
     1361     if (!(parT) and  !(realT) and !(galT))
     1362     { if( !(b2) or defined(TeXnofrac))
    13661363       { monomt = cfmt; msz = 3*size(monomt);}
    13671364       else
     
    13771374// -- now parse the monom
    13781375    if (monom <> 1)
    1379     { i = 1;   
     1376    { i = 1;
    13801377      if(short)
    13811378      { while(s[i]<>"!")
    1382         { monomt = monomt + s[i]; i++; 
     1379        { monomt = monomt + s[i]; i++;
    13831380          b = i;
    13841381          msz = msz + 3; // it was a single lettered var
     
    13961393      }
    13971394    }
    1398    
     1395
    13991396
    14001397
     
    14031400
    14041401   if (TeXwidth > 10 and (linesz + msz > 3*TeXwidth) and linesz)
    1405    { pt = pt + lnbreak + bg; 
    1406      linesz = msz; 
     1402   { pt = pt + lnbreak + bg;
     1403     linesz = msz;
    14071404   }
    1408    else { linesz = linesz + msz; }  // 3 for sign 
     1405   else { linesz = linesz + msz; }  // 3 for sign
    14091406    pt = pt + sign + monomt;
    14101407   sign = "+";
     
    14301427   }
    14311428  else {return(pt);}
    1432 }   
     1429}
    14331430example
    14341431{ "EXAMPLE:"; echo =2;
     
    14371434  texpoly("",f);
    14381435  texpoly("",2x2y23z);
    1439  
     1436
    14401437
    14411438  ring rr= real,(x,y),dp;
     
    14481445  f;
    14491446  texpoly("",f);
    1450 }     
     1447}
    14511448
    14521449static proc parsp(string cfmt, int b)
     
    14891486// sec parameter to see if in parsp a fraction follows
    14901487{ int i,j =1,-1;
    1491   int b,k,jj,mz;                         // begin and end 
     1488  int b,k,jj,mz;                         // begin and end
    14921489  int saveshort=short;
    14931490            string t,c,vn,nom,denom,sg;
     
    17841781 if(system("with","Namespaces")) { exportto(Current,splt); }
    17851782 else { export splt; }
    1786                
     1783
    17871784// string fname = "texlibdemo.tex";
    17881785 string nl = newline;
     
    18111808 Singular in \\LaTeX \\ text.
    18121809 Most of the examples in this document are generated
    1813  randomly by Singular itself and passed through the procs from 
    1814  \\verb|latex.lib|. Consequently, 
     1810 randomly by Singular itself and passed through the procs from
     1811 \\verb|latex.lib|. Consequently,
    18151812 every document does not show merely how the \\verb|latex.lib| works
    18161813 but looks differently in large parts.");
     
    18431840ev);
    18441841
    1845 write(fname,"A flag means in the following that a variable with the indicated 
     1842write(fname,"A flag means in the following that a variable with the indicated
    18461843name has to be defined. Usually it is from type \\verb|int|.");
    18471844
     
    18581855  TeXreplace    : list, entries twoelemented list for replacing symbols
    18591856  NoDollars     : (int) flag, suppresses surrounding \\$ signs
    1860    
     1857
    18611858" +
    18621859ev);
     
    19131910"> ring r0=0,(x,y,z),dp;                       texring(fname,r0);
    19141911> poly g = -x2y +2y13z +1; g;                 texpoly(fname,g);" +nl +
    1915  string(g) + nl + 
     1912 string(g) + nl +
    19161913"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    19171914 splt(string(f)) + nl2 +
     
    19301927write(fname,
    19311928bv +
    1932 "> f = f/280; 
     1929"> f = f/280;
    19331930> texpoly(fname,f);" +nl +
    1934  splt(string(f)) + nl2 + 
     1931 splt(string(f)) + nl2 +
    19351932ev
    19361933);
     
    19441941 if(system("with","Namespaces")) { exportto(Current, r1); }
    19451942 else { export r1; }
    1946  poly g = -2*x1 +x4 -1;                   
     1943 poly g = -2*x1 +x4 -1;
    19471944 poly f = randompoly(5,25,25); f; export f;
    19481945write(fname,
     
    19501947"> ring r1=7,(x1,x2,x3,x4),Ds;                 texring(fname,r1);
    19511948> poly g =  -2*x1 +x4 -1; g;                  texpoly(fname,g);" +nl +
    1952  string(g) + nl + 
     1949 string(g) + nl +
    19531950"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    1954  splt(string(f)) + nl2 + 
     1951 splt(string(f)) + nl2 +
    19551952ev
    1956 ); 
     1953);
    19571954  texring(fname,r1);             write(fname,lb);
    1958   texpoly(fname,g);              write(fname,lb); 
     1955  texpoly(fname,g);              write(fname,lb);
    19591956  texpoly(fname,f);              write(fname,lb);
    19601957write(fname,"\\Line");
     
    19651962" +nl);
    19661963 ring r2=0,(x(1..5),y(1..2)),(ds(5),dp(2));
    1967  poly g = -y(1)*x(5) +y(1)*x(2); g;           
     1964 poly g = -y(1)*x(5) +y(1)*x(2); g;
    19681965 poly f = randompoly(5,25,25); f;
    19691966write(fname,
     
    19711968"> ring r2=0,(x(1..5),y(1..2)),(ds(5),dp(2));  texring(fname,r2);
    19721969> poly g = -y(1)*x(5) +y(1)*x(2); g;          texpoly(fname,g);"  +nl +
    1973  string(g) + nl + 
     1970 string(g) + nl +
    19741971"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    1975  splt(string(f)) + nl2 + 
    1976 ev 
    1977 ); 
     1972 splt(string(f)) + nl2 +
     1973ev
     1974);
    19781975  texring(fname,r2);             write(fname,lb);
    1979   texpoly(fname,g);              write(fname,lb); 
     1976  texpoly(fname,g);              write(fname,lb);
    19801977  texpoly(fname,f);              write(fname,lb);
    19811978write(fname,"\\Line");
     
    19881985 if(system("with","Namespaces")) { exportto(Current, r3); }
    19891986 else { export r3; }
    1990  poly g = -x_1*x_2 + 2*x_2*x_3 + x_1*x_3; g;     
     1987 poly g = -x_1*x_2 + 2*x_2*x_3 + x_1*x_3; g;
    19911988 poly f = randompoly(5,25,25); f;            export f;
    19921989write(fname,
     
    19941991"> ring r3=0,(x_1,x_2,x_3),wp(3,2,1);          texring(fname,r3);
    19951992> poly g = -x_1*x_2 + 2*x_2*x_3 + x_1*x_3; g; texpoly(fname,g);"  +nl +
    1996   string(g) + nl + 
     1993  string(g) + nl +
    19971994"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    1998  splt(string(f)) + nl2 + 
     1995 splt(string(f)) + nl2 +
    19991996ev
    2000 ); 
     1997);
    20011998  texring(fname,r3);             write(fname,lb);
    2002   texpoly(fname,g);              write(fname,lb); 
     1999  texpoly(fname,g);              write(fname,lb);
    20032000  texpoly(fname,f);              write(fname,lb);
    20042001write(fname,"\\Line");
     
    20082005" A ring with real coefficients and matrix ordering.
    20092006" +nl);
    2010  ring rr =real,(x,y),M(1,2,3,4);           
    2011  poly g = -1.2e-10*x + y +1;   
     2007 ring rr =real,(x,y),M(1,2,3,4);
     2008 poly g = -1.2e-10*x + y +1;
    20122009 poly f = randompoly(5,25,25); f;
    20132010write(fname,
     
    20152012"> ring rr =real,(x,y),M(1,2,3,4);             texring(fname,rr);
    20162013> poly g = -1.2e-10*x + y +1; g;              texpoly(fname,g);" +nl +
    2017  string(g) + nl + 
     2014 string(g) + nl +
    20182015"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    2019  splt(string(f)) + nl2 + 
     2016 splt(string(f)) + nl2 +
    20202017ev
    2021 ); 
     2018);
    20222019  texring(fname,rr);             write(fname,lb);
    2023   texpoly(fname,g);              write(fname,lb); 
     2020  texpoly(fname,g);              write(fname,lb);
    20242021  texpoly(fname,f);              write(fname,lb);
    20252022write(fname,"\\Line");
     
    20292026" A ring in characteristic 0 and indexed parameters.
    20302027" +nl);
    2031  ring r0t=(0,s,t),(x,y),dp; 
     2028 ring r0t=(0,s,t),(x,y),dp;
    20322029 if(system("with","Namespaces")) { exportto(Current, r0t); }
    20332030 else { export r0t; }
    2034  poly g = 8*(-s+2t)/(st+t3)*x + t2*x -1; g;     
     2031 poly g = 8*(-s+2t)/(st+t3)*x + t2*x -1; g;
    20352032 poly f = randompoly(5,25,25); f;  export f;
    20362033write(fname,
     
    20382035"> ring r0t=(0,s,t),(x,y),dp;                  texring(fname,r0t);
    20392036> poly g = 8*(-s+2t)/(st+t3)*x + t2*x -1; g;  texpoly(fname,g);" +nl +
    2040  string(g) + nl + 
     2037 string(g) + nl +
    20412038"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    2042  splt(string(f)) + nl2 + 
     2039 splt(string(f)) + nl2 +
    20432040ev
    2044 ); 
     2041);
    20452042  texring(fname,r0t);            write(fname,lb);
    2046   texpoly(fname,g);              write(fname,lb); 
     2043  texpoly(fname,g);              write(fname,lb);
    20472044  texpoly(fname,f);              write(fname,lb);
    20482045write(fname,"\\Line");
     
    20532050" A ring in characteristic 11 and indexed parameters.
    20542051" +nl);
    2055  ring rt=(11003,t1,t2,t3),(X,Y),dp;           
    2056  poly g = 8*(-t1+t2)/(t1+t3)*X + t2*Y -1; g;     
     2052 ring rt=(11003,t1,t2,t3),(X,Y),dp;
     2053 poly g = 8*(-t1+t2)/(t1+t3)*X + t2*Y -1; g;
    20572054 poly f = randompoly(5,25,25); f;
    20582055write(fname,
     
    20602057"> ring rt=(11003,t1,t2,t3),(X,Y),dp;             texring(fname,rt);
    20612058> poly g = 8*(-t1+t2)/(t1+t3)*X + t2*Y -1; g; texpoly(fname,g);" +nl +
    2062  string(g) + nl + 
     2059 string(g) + nl +
    20632060"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    2064  splt(string(f)) + nl2 + 
     2061 splt(string(f)) + nl2 +
    20652062ev
    2066 ); 
     2063);
    20672064  texring(fname,rt);             write(fname,lb);
    2068   texpoly(fname,g);              write(fname,lb); 
     2065  texpoly(fname,g);              write(fname,lb);
    20692066  texpoly(fname,f);              write(fname,lb);
    20702067write(fname,"\\Line");
     
    20742071" A ring over an algebraic extension in char 7.
    20752072" +nl);
    2076  ring ralg = (7,a),x,dp;                 
    2077  minpoly = a2-a+3;                       
    2078  poly g = -(2a13 +a)*x2 + a2*x -a +1; g;         
     2073 ring ralg = (7,a),x,dp;
     2074 minpoly = a2-a+3;
     2075 poly g = -(2a13 +a)*x2 + a2*x -a +1; g;
    20792076 poly f = randompoly(5,25,25); f;
    20802077write(fname,
    20812078bv +
    2082 "> ring ralg = (7,a),x,dp;               
     2079"> ring ralg = (7,a),x,dp;
    20832080> minpoly = a2-a+3;                           texring(fname,ralg);
    20842081> poly g = -(2a13 +a)*x2 + a2*x -a +1; g;    texpoly(fname,g);" +nl +
    2085  string(g) + nl + 
     2082 string(g) + nl +
    20862083"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    2087  splt(string(f)) + nl2 + 
     2084 splt(string(f)) + nl2 +
    20882085ev
    2089 ); 
     2086);
    20902087  texring(fname,ralg);           write(fname,lb);
    2091   texpoly(fname,g);              write(fname,lb); 
     2088  texpoly(fname,g);              write(fname,lb);
    20922089  texpoly(fname,f);              write(fname,lb);
    20932090write(fname,"\\Line");
     
    20952092// -8-------- the same ring a in 7 ralg, defined with gftables -- F_49 -------
    20962093write(fname,
    2097 " A ring defined with \\verb|gftables|, the same as \\verb|ralg| before, but 
     2094" A ring defined with \\verb|gftables|, the same as \\verb|ralg| before, but
    20982095with primitive element in the Galoisfield $\\F_{49}$." +nl);
    20992096 ring r49 =(49,a),x,dp;
    21002097 if(system("with","Namespaces")) { exportto(Current, r49); }
    21012098 else { export r49; }
    2102  poly g = -(2a13 +a)*x2 + a2*x -a +1; g;  export g;   
     2099 poly g = -(2a13 +a)*x2 + a2*x -a +1; g;  export g;
    21032100 poly f = randompoly(5,25,25); f;
    21042101write(fname,
     
    21062103"> ring r49 =(49,a),x,dp;                     texring(fname,r49);
    21072104> poly g = -(2a13 +a)*x2 + a2*x -a +1; g;    texpoly(fname,g);" +nl +
    2108  string(g) + nl + 
     2105 string(g) + nl +
    21092106"> poly f = randompoly(5,25,25); f;           texpoly(fname,f);" +nl +
    2110  splt(string(f)) + nl2 + 
     2107 splt(string(f)) + nl2 +
    21112108ev
    2112 ); 
     2109);
    21132110  texring(fname,r49);            write(fname,lb);
    2114   texpoly(fname,g);              write(fname,lb); 
     2111  texpoly(fname,g);              write(fname,lb);
    21152112  texpoly(fname,f);              write(fname,lb);
    21162113write(fname,"\\Line");
     
    21212118" +nl);
    21222119 ring ri=(0,i),(x,y,z),ls;
    2123  minpoly = i2 +1;                         
    2124  poly g = -(i+1)*x +2i2y2 +i +x; g;         
     2120 minpoly = i2 +1;
     2121 poly g = -(i+1)*x +2i2y2 +i +x; g;
    21252122 poly f = randompoly(5,25,25); f;
    21262123write(fname,
     
    21292126> minpoly = i2 +1;                            texring(fname,ri);
    21302127> poly g = -(i+1)*x +2i2y2 +i +x; g;          texpoly(fname,g);" +nl +
    2131  string(g) + nl + 
     2128 string(g) + nl +
    21322129"> poly f = randompoly(5,25,25); f;            texpoly(fname,f);" +nl +
    2133  splt(string(f)) + nl2 + 
     2130 splt(string(f)) + nl2 +
    21342131ev
    2135 ); 
     2132);
    21362133  texring(fname,ri);              write(fname,lb);
    2137   texpoly(fname,g);              write(fname,lb); 
     2134  texpoly(fname,g);              write(fname,lb);
    21382135  texpoly(fname,f);              write(fname,lb);
    21392136write(fname,"\\Line");
     
    21442141" +nl);
    21452142 setring r0;
    2146  ideal I = x2-y,y+z2, xy;           
     2143 ideal I = x2-y,y+z2, xy;
    21472144 I = std(I);
    21482145string sI = string(I);
     
    21552152> string(I);" + nl +
    21562153splt(sI) + nl +
    2157 "> qring qr = I;                   texring(fname,qr);" + 
     2154"> qring qr = I;                   texring(fname,qr);" +
    21582155ev
    2159 ); 
     2156);
    21602157  texring(fname,qr);              write(fname,lb);
    21612158
     
    21702167// changing the brackets
    21712168
    2172 write(fname,"If the displayed  and defaulted brackets for the ring are not 
     2169write(fname,"If the displayed  and defaulted brackets for the ring are not
    21732170the rigth one,
    21742171correct brackets my be passed over to \\verb|texring|",nl,
     
    21802177write(fname,
    21812178bv +
    2182 "> texring(fname,rr,\"{{\");" + nl + 
     2179"> texring(fname,rr,\"{{\");" + nl +
    21832180ev
    2184 ); 
     2181);
    21852182
    21862183texring(fname,rr,"{{");
     
    21882185write(fname,
    21892186bv +
    2190 "> texring(fname,r2,\"[\");" + nl + 
     2187"> texring(fname,r2,\"[\");" + nl +
    21912188ev
    2192 ); 
     2189);
    21932190
    21942191texring(fname,r2,"[");
     
    21962193write(fname,nl2);
    21972194
    2198 write(fname,nl2,"The brackets around the ideal in a quotientring can be 
    2199 changed  with the global variable \\verb|TeXbrack| (see the section 
     2195write(fname,nl2,"The brackets around the ideal in a quotientring can be
     2196changed  with the global variable \\verb|TeXbrack| (see the section
    22002197{\\tt ideal}).",nl);
    22012198
     
    22042201bv +
    22052202"> string TeXbrack = \"<\";
    2206 > texring(fname,qr); 
     2203> texring(fname,qr);
    22072204> kill TeXbrack;" + nl +
    22082205ev
    2209 ); 
     2206);
    22102207
    22112208string TeXbrack = "<"; export TeXbrack;
     
    22232220write(fname,
    22242221bv +
    2225 "> texring(fname,r3,\"\\\\C\");" + nl + 
     2222"> texring(fname,r3,\"\\\\C\");" + nl +
    22262223ev
    2227 ); 
     2224);
    22282225
    22292226texring(fname,r3,"\\C");
     
    22322229write(fname,nl2, "naechster abschnitt stimmt nicht"+lb,nl2);
    22332230
    2234 write(fname,"Predefined and accepted values here are 
     2231write(fname,"Predefined and accepted values here are
    22352232\\verb|\"\\\\C\"|, \\verb|\"\\\\R\"|,
    22362233 \\verb|\"\\\\C\"|, \\verb|\"k\"|, \\verb|\"K\"|, \\verb|\"R\"|.");
    2237 write(fname,"The latter are useful to print a ring whose coefficientfield is 
     2234write(fname,"The latter are useful to print a ring whose coefficientfield is
    22382235defined by an algebraic extension. Now the parameters will omitted completely.
    22392236");
    2240 write(fname,"The user may specify then the field in more detail."+lb,nl2); 
     2237write(fname,"The user may specify then the field in more detail."+lb,nl2);
    22412238
    22422239write(fname,"Any correct letter in \\LaTeX \\ notation may be used to describe
    2243 the coefficientfield. If the letter is k, K or R it  forces \\verb|texring| 
     2240the coefficientfield. If the letter is k, K or R it  forces \\verb|texring|
    22442241not to print the parameters. This will be useful for a ring described by an
    22452242algebraic extension",nl2);
     
    22472244write(fname,
    22482245bv +
    2249 "> texring(fname,ralg,\"k\");" + nl + 
     2246"> texring(fname,ralg,\"k\");" + nl +
    22502247ev
    2251 ); 
     2248);
    22522249
    22532250texring(fname, ralg,"k");
    2254  
     2251
    22552252// texobj(fname,"with k = ");
    22562253
     
    22602257write(fname,
    22612258bv +
    2262 "> texring(fname,ralg,\"mipo\");" + nl + 
     2259"> texring(fname,ralg,\"mipo\");" + nl +
    22632260ev
    2264 ); 
     2261);
    22652262
    22662263texring(fname, ralg,"mipo");
     
    22782275"> intvec v = 5,6;
    22792276> texring(fname,r2,v);
    2280 > kill v;" + nl + 
     2277> kill v;" + nl +
    22812278ev
    2282 ); 
     2279);
    22832280
    22842281intvec v = 5,6;
     
    22922289write(fname,
    22932290bv +
    2294 "> texring(fname,r1,1);" + nl + 
     2291"> texring(fname,r1,1);" + nl +
    22952292ev
    2296 ); 
     2293);
    22972294texring(fname,r1,1);
    22982295
     
    23072304write(fname,
    23082305bv +
    2309 "> texring(fname,r0,\"^G\");" + nl + 
     2306"> texring(fname,r0,\"^G\");" + nl +
    23102307ev
    2311 ); 
     2308);
    23122309
    23132310texring(fname, r0,"^G");
    2314  
    2315 write(fname,nl2,"All these arguments may be passed over in any order as 
    2316 optional arguments, but it may give a rather nonsense result if too much of 
     2311
     2312write(fname,nl2,"All these arguments may be passed over in any order as
     2313optional arguments, but it may give a rather nonsense result if too much of
    23172314them  are used at the same time",nl);
    23182315
    23192316write(fname,
    23202317bv +
    2321 "> texring(fname,r3,\"\\\\R\",1,\"{{\",\"^G\");" + nl + 
     2318"> texring(fname,r3,\"\\\\R\",1,\"{{\",\"^G\");" + nl +
    23222319ev
    2323 ); 
     2320);
    23242321
    23252322texring(fname, r3,"\\R",1,"<<","^G");
     
    23442341  }
    23452342  else { texdemopart=2; }
    2346  
     2343
    23472344 "Continuing Part2 of " + fname + nl;
    23482345
     
    23522349write(fname,"The command \\verb|texfactorize| calls internally the Singular
    23532350command \\verb|factorize| and returns the product of the irreducible factors.
    2354 at the present it is not possible to pass the optional arguments of 
     2351at the present it is not possible to pass the optional arguments of
    23552352\\verb|factorize| through \\verb|texfactorize|."+lb);
    23562353
     
    24072404// TeXreplace
    24082405// ---------------------------------------------
    2409 write(fname,"The global variable \\verb|TeXreplace| must be a list 
     2406write(fname,"The global variable \\verb|TeXreplace| must be a list
    24102407whose entries are twoelemented lists again; wherby the first entry is the
    24112408word which should be replaced and second is the replacing word."  +
    2412 "This is may be applied to replace variablenames, but holds  also for texname 
     2409"This is may be applied to replace variablenames, but holds  also for texname
    24132410anmd texmap" + lb +
    24142411"It is most useful to write the greece letters correctly. Notice that it
    24152412is necesarry to write
    2416 a double backslash \\verb|\\\\\ | at the beginning of 
     2413a double backslash \\verb|\\\\\ | at the beginning of
    24172414a \\TeX \\ symbol." + lb);
    24182415
     
    24732470
    24742471write(fname,"If \\verb|TeXreplace| is defined, the translation into \\TeX  code
    2475 runs significantly slower, because every polynomial will be compiled in the 
     2472runs significantly slower, because every polynomial will be compiled in the
    24762473\\verb|non short| mode."+ lb );
    24772474
     
    24802477//linebreaking   TeXwdith
    24812478//-----------------------------------------------------------------------
    2482 write(fname,"The global variable \\verb|TeXwidth| controls the wrapping of 
     2479write(fname,"The global variable \\verb|TeXwidth| controls the wrapping of
    24832480polynomials; possible values are:" + lb);
    24842481
     
    24892486" -1 & \\text{no linebreaking} \\\\ ",
    24902487"  0 & \\text{print the polynom as equation} f=0 \\\\ ",
    2491 " 1,\\ldots,5 & \\text{ the first n termes followed by the sign of the next 
     2488" 1,\\ldots,5 & \\text{ the first n termes followed by the sign of the next
    24922489term} \\\\ ",
    24932490" > 5 & \\text{wrapping after n letters corresponding x} ",
     
    24952492"\\]",nl);
    24962493
    2497 write(fname,"Notice that two letters like x counts as three subscripts or 
     2494write(fname,"Notice that two letters like x counts as three subscripts or
    24982495exponents",nl);
    24992496
     
    25032500
    25042501write(fname,"\\verb|TeXwidth| is the only global variable which will be defined
    2505 automatically from Singular. Its default value is -1 
     2502automatically from Singular. Its default value is -1
    25062503i.e. wrapping is set off."+ lb);
    25072504
     
    25772574//write(fname,nl2,"\\Line",nl);
    25782575
    2579 write(fname,"As seen there are two possibilities to tex a polynomial. The 
     2576write(fname,"As seen there are two possibilities to tex a polynomial. The
    25802577command \\verb|texpoly| is the most basic one and sets the polynomials in
    25812578textmode. Notice that it counts the length of the terms convenientely." + lb +
     
    25882585bv +
    25892586"> setring r3;
    2590 > texpoly(fname,f/180);" + nl + 
     2587> texpoly(fname,f/180);" + nl +
    25912588ev);
    25922589
    25932590
    25942591setring r3;
    2595 texpoly(fname,f/180); 
     2592texpoly(fname,f/180);
    25962593
    25972594write(fname,nl2, "Now the same again with \\verb|texobj| "+ lb,nl);
     
    26082605write(fname,"Some explaination how it works: if \\verb|texobj| is called for
    26092606a polynomial, then it defines a global variable \\verb|TeXdisp| which forces
    2610 \\verb|texpoly| to count fraction with space corresponding 
     2607\\verb|texpoly| to count fraction with space corresponding
    26112608the displaymode."+lb,nl2);
    26122609
     
    26182615
    26192616
    2620 ring r; 
     2617ring r;
    26212618ideal I = 3xz5+x2y3-3z,7xz5+y3z+x-z,-xyz2+4yz+2x;
    26222619
     
    26722669 ideal I = -x(1) + 2*x(3) + x(5),x(2) -x(4) +2*x(5) -1,8*x(1) +x(4) +2;
    26732670
    2674  TeXwidth = 0; 
    2675 write(fname,
    2676 bv +
    2677 "> ring r5 = 0,x(1..5),dp ; 
     2671 TeXwidth = 0;
     2672write(fname,
     2673bv +
     2674"> ring r5 = 0,x(1..5),dp ;
    26782675> ideal I = -x(1) + 2*x(3) + x(5),x(2) -x(4) +2*x(5) -1,8*x(1) +x(4) +2;
    26792676> string(I);" + nl +
    2680 splt(string(I)) + nl2 + 
    2681 "> TeXwidth = 0; 
     2677splt(string(I)) + nl2 +
     2678"> TeXwidth = 0;
    26822679> texobj(fname,I);" +
    26832680//> TeXwidth = 0;" +
    26842681ev
    2685 ); 
     2682);
    26862683
    26872684 texobj(fname,I);
    26882685// TeXwidth = -1;
    2689  
     2686
    26902687 setring r;
    26912688 ideal J;
     
    27142711write(fname,
    27152712bv +
    2716 "> texobj(fname,J);" + 
     2713"> texobj(fname,J);" +
    27172714ev
    2718 ); 
    2719  
     2715);
     2716
    27202717 texobj(fname,J);
    27212718//% TeXwidth = 0; TeXbrackets
     
    27312728ev);
    27322729
    2733 setring r; 
     2730setring r;
    27342731ideal I = 3xz5+x2y3-3z,7xz5+y3z+x-z,-xyz2+4yz+2x;
    27352732if(system("with","Namespaces")) { exportto(Current, r, I); }
     
    27652762// int TeXwidth =-1;
    27662763write(fname,bv +
    2767 "> ring r1=0,(x,y,z),dp; 
     2764"> ring r1=0,(x,y,z),dp;
    27682765> ring r2=0,(u,v),dp;
    27692766> map phi = r1,u2,uv -v,v2;
     
    27862783write(fname,"\\item",nl);
    27872784
    2788 write(fname,"If the map will be called by its name \\verb|texmap| can in 
     2785write(fname,"If the map will be called by its name \\verb|texmap| can in
    27892786combination with \\verb|TeXreplace| print the name of the map." + lb ,nl);
    27902787
     
    27922789"> list TeXreplace;
    27932790> TeXreplace[1] = list(\"phi\",\"\\\\phi\");
    2794 > texmap(fname,\"phi\",r1,r2);" + nl + 
     2791> texmap(fname,\"phi\",r1,r2);" + nl +
    27952792ev);
    27962793
     
    28142811write(fname,"\\item",nl);
    28152812
    2816 write(fname,nl2,"The addtional arguments for \\verb|rings| may be passed over 
     2813write(fname,nl2,"The addtional arguments for \\verb|rings| may be passed over
    28172814in \\verb|texmap|.",nl);
    28182815
    2819 write(fname,"In the following form the arguments are valid for both 
     2816write(fname,"In the following form the arguments are valid for both
    28202817\\verb|rings|.",nl);
    28212818
     
    28672864texobj(fname,H);
    28682865
    2869 // probiere auch V = 0 bei texobj aus 
     2866// probiere auch V = 0 bei texobj aus
    28702867matrix M = H;
    28712868
     
    29052902//------------------------------------------------------------------------
    29062903
    2907 write(fname,"All the features for \\verb|poly| and the features for 
     2904write(fname,"All the features for \\verb|poly| and the features for
    29082905\\verb|intmat| or \\verb|intvec| hold here, too.");
    29092906
     
    29122909write(fname,bv +
    29132910"> TeXwidth = 1;",
    2914 "> texobj(fname,H);", 
     2911"> texobj(fname,H);",
    29152912"> TeXwidth = -1;",
    29162913ev );
    29172914
    29182915TeXwidth = 1;
    2919 texobj(fname,H); 
     2916texobj(fname,H);
    29202917TeXwidth = -1;
    29212918
     
    29362933
    29372934write(fname,bv +
    2938 "> int TeXnofrac;", 
     2935"> int TeXnofrac;",
    29392936"> texobj(fname,M);",
    29402937"> kill TeXnofrac;",
     
    30022999> v;" + nl +
    30033000string(v) + nl +
    3004 "> nrows(v);" + nl + 
     3001"> nrows(v);" + nl +
    30053002string(nrows(v)) + nl +
    30063003"texobj(fname,v);" + nl2 +
     
    30173014"> intmat m[3][4] = -1,3,5,2,-2,8,6,0,2,5,8,7;" + nl +
    30183015"> m;" + nl +
    3019 string(m) + nl + 
     3016string(m) + nl +
    30203017"> texobj(fname,m);" + nl2 +
    30213018ev );
     
    30703067"> intmat mat[3][3] = 1,2,3,4,5,6,7,8,9;" + nl +
    30713068"> string TeXbrack = \"|\";" + nl +
    3072 "> texobj(fname,mat,\"=\",det(mat)); " + nl2 + 
     3069"> texobj(fname,mat,\"=\",det(mat)); " + nl2 +
    30733070ev );
    30743071
     
    30833080
    30843081
    3085 //write(fname,"The proc \\verb|texname| is used to write indexed names in a 
     3082//write(fname,"The proc \\verb|texname| is used to write indexed names in a
    30863083//correct way"+lb,nl);
    30873084
     
    31123109
    31133110 proc cleantexdemo()
    3114  { 
     3111 {
    31153112  kill fname,nl,nl2,lb,bv,ev;
    31163113  return();
Note: See TracChangeset for help on using the changeset viewer.