Newbie Question: String variable type and filename
Subject: Newbie Question: String variable type and filename
From: Stavros Macrakis
Date: Mon, 5 Apr 2004 11:34:23 -0400
> I want to set the filename as a string variable, and use it
> in the subsequent calls to the "tex" function
The "tex" function is trying to be clever and provide all sorts of
convenience features. In particular, it automatically quotes its second
argument so that you can say things like tex(expr,expr) and the *value*
of expr will be output to a file named "expr". This is an
extraordinarily bad idea, and unfortunately rather widespread within
Maxima. Here is a substitute function which fixes that problem. (I
know, this is ugly, too, just grit your teeth and type it in.)
texf(expr,file) ::= buildq([expr,file:ev(file)],tex(expr,file))$
Note that this preserves the other "convenience" features of tex, such
as preserving D-labels.
Now you can say:
filename: "c:\\docs\\maxima\\somefile.tex"$
texf(expr,filename)$
and it will work.
Sorry for the bad interface.
Some additional specific comments on your mail:
The (misleadingly named) 'string' function is not needed for
manipulating strings -- it just converts an *expression* into a quoted
string. What might be confusing you here is that a plain string is
normally displayed without the surrounding quotation marks which you use
on input....
-s