# Changeset 651b46 in git

Ignore:
Timestamp:
May 20, 1998, 5:40:07 PM (25 years ago)
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
ea35599e9a4a656449259a45a33777c6075d7e6a
Parents:
a5279cef2f7895ec8e67e6a1c0e9ee30da6f7511
Message:
Ch. Gorzel latex.lib updated

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

Unmodified
Removed
• ## Singular/LIB/latex.lib

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