Home Online Manual
Back: texfactorize
Forward: texname
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).

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

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.

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.

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;
==> // ** `@r1` is already global
ring r2=0,(u,v),dp;
map @phi =(@r1,u2,uv -v,v2); export @phi;
==> // ** `@phi` is already global
list TeXreplace;
TeXreplace[1] = list("@phi","\\phi");    // @phi --> \phi
export TeXreplace;
==> // ** `TeXreplace` is already global
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
==> // ** `TeXaligned` is already global
==> $\Q[x,y,z]\longrightarrow\Q[u,v], \ \left(x,y,z\right)\longmapsto \left(u\
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;}