|
D.9.2.8 texobj
Procedure from library latex.lib (see latex_lib).
- Usage:
- texobj(fname,l); fname string, l list
- Return:
- if
fname="" : string, the entries of l in LaTeX-typesetting;
otherwise: append this string to the file <fname> , and
return nothing.
- Note:
- preceding ">>" are deleted in
fname , and suffix ".tex"
(if not given) is added to fname .
Example:
| LIB "latex.lib";
// -------- prepare for example ---------
if (defined(TeXaligned)) {int Teali=TeXaligned; kill TeXaligned;}
if (defined(TeXbrack)){string Tebra=TeXbrack; kill TeXbrack;}
//
// -------------- typesetting for polynomials ----------
ring r = 0,(x,y),lp;
poly f = x5y3 + 3xy4 + 2xy2 + y6;
f;
==> x5y3+3xy4+2xy2+y6
texobj("",f);
==> $$
==> \begin{array}{rl}
==> & x^{5}y^{3}+3xy^{4}+2xy^{2}+y^{6}\\
==> \end{array}
==> $$
// -------------- typesetting for ideals ----------
ideal G = jacob(f);
G;
==> G[1]=5x4y3+3y4+2y2
==> G[2]=3x5y2+12xy3+4xy+6y5
texobj("",G);
==> $$
==> \left(
==> \begin{array}{c}
==> 5x^{4}y^{3}+3y^{4}+2y^{2}, \\
==> 3x^{5}y^{2}+12xy^{3}+4xy+6y^{5}
==> \end{array}
==> \right)$$
// -------------- variation of typesetting for ideals ----------
int TeXaligned = 1; export TeXaligned;
==> // ** `TeXaligned` is already global
string TeXbrack = "<"; export TeXbrack;
==> // ** `TeXbrack` is already global
texobj("",G);
==> $\left<5x^{4}y^{3}+3y^{4}+2y^{2},3x^{5}y^{2}+12xy^{3}+4xy+6y^{5}\right>$
kill TeXaligned, TeXbrack;
// -------------- typesetting for matrices ----------
matrix J = jacob(G);
texobj("",J);
==> $$
==> \left(
==> \begin{array}{*{2}{c}}
==> 20x^{3}y^{3} & 15x^{4}y^{2}+12y^{3}+4y \\
==> 15x^{4}y^{2}+12y^{3}+4y & 6x^{5}y+36xy^{2}+4x+30y^{4}
==> \end{array}
==> \right)
==> $$
// -------------- typesetting for intmats ----------
intmat m[3][4] = 9,2,4,5,2,5,-2,4,-6,10,-1,2,7;
texobj("",m);
==> $$
==> \left(
==> \begin{array}{*{4}{r}}
==> 9 & 2 & 4 & 5\\
==> 2 & 5 & -2 & 4\\
==> -6 & 10 & -1 & 2
==> \end{array}
==> \right)
==> $$
//
// --- restore global variables if previously defined ---
if (defined(Teali)){int TeXaligned=Teali; export TeXaligned; kill Teali;}
if (defined(Tebra)){string TeXbrack=Tebra; export TeXbrack; kill Tebra;}
|
|