Home Online Manual
Top
Back: texfactorize
Forward: texname
FastBack:
FastForward:
Up: latex_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.9.2.6 texmap

Procedure from library latex.lib (see latex_lib).

Usage:
texmap(fname,m,@r1,@r2); fname string, m string/map, @r1,@r2 rings

Return:
if fname="": string, the map m from @r1 to @r2 (preceded by its name if m = string) in TeX-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. If m is a string then it has to be the name of an existing map from @r1 to @r2.

Example:
 
LIB "latex.lib";
// -------- prepare for example ---------
if (defined(TeXaligned)) {int Teali=TeXaligned; kill TeXaligned;}
if (defined(TeXreplace)) {list Terep=TeXreplace; kill TeXreplace;}
// -------- the example starts here ---------
//
string fname = "tldemo";
ring @r1=0,(x,y,z),dp;
export @r1;
ring r2=0,(u,v),dp;
map @phi =(@r1,u2,uv -v,v2); export @phi;
list TeXreplace;
TeXreplace[1] = list("@phi","\\phi");    // @phi --> \phi
export TeXreplace;
texmap("","@phi",@r1,r2);                // standard form
==> $$
==> \begin{array}{rcc}
==> \phi:\Q[x,y,z] & \longrightarrow & \Q[u,v]\\[2mm]
==> \left(x,y,z\right) & \longmapsto & 
==>  \left(
==> \begin{array}{c}
==> u^{2}\\
==> uv-v\\
==> v^{2}
==> \end{array}
==> \right)
==> \end{array}
==> $$
//
int TeXaligned; export TeXaligned;       // map in one line
texmap("",@phi,@r1,r2);
==> $\Q[x,y,z]\longrightarrow\Q[u,v], \ \left(x,y,z\right)\longmapsto \left(u\
   ^{2},uv-v,v^{2}\right)$
//
kill @r1,TeXreplace,TeXaligned;
//
// --- restore global variables if previously defined ---
if (defined(Teali)) {int TeXaligned=Teali; export TeXaligned; kill Teali;}
if (defined(Terep)) {list TeXreplace=Terep; export TeXreplace; kill Terep;}