From: Robert D. <rob...@us...> - 2008-03-29 16:53:24
|
Update of /cvsroot/maxima/maxima/tests In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9208/tests Modified Files: rtest_tex.mac Log Message: Enable TeX output to output stream. * src/mactex.lisp: (1) in TEX1, recognize output stream argument (2) in TEX-ATOM, unrelated minor bug fix: be more careful about grabbing reverse alias * tests/rtest_tex.mac: test stream output and other functions * doc/info/Input.texi: update description of tex Index: rtest_tex.mac =================================================================== RCS file: /cvsroot/maxima/maxima/tests/rtest_tex.mac,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- rtest_tex.mac 26 Oct 2006 14:44:26 -0000 1.4 +++ rtest_tex.mac 29 Mar 2008 16:53:15 -0000 1.5 @@ -1,6 +1,10 @@ +/* Various tests of TeX output. Run it via batch("tests/rtest_tex.mac"). + * This program is not organized (at present) in actual result -- expected result pairs. + */ + latex0 (s) := (print ("\\documentclass{article}"), - print (sconcat ("\\title{", s, "}")), + print (concat ("\\title{", s, "}")), print ("\\author{by Maxim A.}"), print ("\\begin{document}"), print ("\\maketitle")); @@ -17,7 +21,7 @@ '((aa or bb) and not (cc or dd)); -with_stdout ("tmp.tex", +with_stdout ("tmp-rtest-1.tex", (latex0 ("Maxima \\TeX\\ test page"), tex_text ("\\subsection*{Symbols and subscripts}"), @@ -46,10 +50,9 @@ tex_text ("\\subsection*{Strings}"), tex ("riff"), tex ("Riff Raff"), - tex (sconcat ("Riff Raff (Lisp string)")), /* sconcat returns a Lisp string for some reason */ - ?stringdisp: true, + stringdisp: true, tex ("Riff Raff (enclosed in `quote marks')"), - ?stringdisp: false, + stringdisp: false, tex ("String containing a newline."), tex ("String containing \\ldots \\\"Oyster sh\\'ell \\ldots some \\TeX\\ commands."), @@ -189,3 +192,67 @@ * tex (''(first (labels (%i)))), */ latex1 ())); + +/* Test output options: standard output, string, file, and stream. + */ + +with_stdout ("tmp-rtest-2a.tex", + tex ("Capture standard output to tmp-rtest-2a.tex.")); + +S : tex ("Capture string output to S, then write S to tmp-rtest-2b.tex.", false); +s : openw ("tmp-rtest-2b.tex"); +printf (s, "~a~%", S); +close (s); + +tex ("Write output directly to tmp-rtest-2c.tex.", "tmp-rtest-2c.tex"); + +s : openw ("tmp-rtest-2d.tex"); +tex ("Write output to output stream opened to tmp-rtest-2d.tex.", s); +close (s); + +/* Test TeX environment functions. + */ + +set_tex_environment_default (" +\\begin{equation} +", " +\\end{equation} +"); + +set_tex_environment ("=", "$", "$"); +set_tex_environment (":=", "$$", "$$"); + +s : openw ("tmp-rtest-3.tex"); + +with_stdout (s, + print ("\\documentclass{article}"), + print ("\\title{A \\TeX\\ environment test}"), + print ("\\author{Maxim A.}"), + print ("\\begin{document}"), + print ("\\maketitle"), + print ("Here are some formulas. These should be numbered."), + tex ((a + b)/(c + d)), + tex (sin(x)/(1-sin(x))), + tex (erf(x)*gamma(x)), + print ("More text here. Followed by a formula embedded in the text."), + tex (b - a = d - c), + print ("More text here. A function definition."), + tex (foo(x) := 1 - 1/x)); + +with_stdout (s, + tex_text ("Let's take this opportunity to test the interaction of\ + $\\mathbf{tex}$ and $\\mathbf{ordergreat}$."), + tex_text ("Here are some variables before calling $\\mathbf{ordergreat}$."), + tex (x + y + z + t = x * y * z * t)); + +ordergreat (x, y, z, t); + +with_stdout (s, + tex_text ("After calling $\\mathbf{ordergreat}(x, y, z, t)$, which constructs alias variables.\ + We should still see just the original variables."), + tex (x + y + z + t = x * y * z * t), + print ("That's all, folks."), + print ("\\end{document}")); + +close (s); +unorder (); /* undo ordergreat above */ |