Skip to Content.
Sympa Menu

texmacs-users - Re : [TeXmacs] Maxima and Texmacs

Subject: mailing-list for TeXmacs Users

List archive

Re : [TeXmacs] Maxima and Texmacs


Chronological Thread 
  • From: "Andrey G. Grozin" <address@hidden>
  • To: address@hidden
  • Subject: Re : [TeXmacs] Maxima and Texmacs
  • Date: Tue, 26 Aug 2008 15:42:40 +0700 (NOVST)

Hello *,

The current version of maxima is 5.16.3; new versions appear quite often. It is very tiresome to edit these 2 files after each of them.

The attached files should work for all previous and future versions of maxima, at least until TeX generation in maxima will change in some incompatible way (then a new texmacs-maxima-x.y.z.lisp will be needed).

The problem with the above files is that Joris says that they don't work on his Mac. I tried them on my friend's Mac notebook, and they work fine. The difference can be traced to a single 'sed' command which extracts 3 components of the maxima version from a line which contains them. The following line (when executed in /bin/sh ):

echo 'version 5.16.3, lisp sbcl' |\
sed -e 's/^version \([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1 \2 \3/'

should produce

5 16 3

according to sed documentation, and it does so on Linux. It does so also on my friend's Mac. Joris says that it does not on his Mac.

Please, MacOS users round here, try this line and tell me if it works as expected or not. Maybe, we'll be able to find out what causes problems - a specific version of MacOS, of sed or whatever. If we'll be able to write this single line in a way that works on all systems, permanent troubles with TeXmacs not supporting a new version of maxima will come to end.

Andrey#!/bin/sh
# if there is an argument, find maxima_toc.html

find_old_help()
{
if grep -F 'MAXIMA_DIRECTORY=' $MAXIMA >/dev/null
then
MAXIMA_DIRECTORY=`grep -F 'MAXIMA_DIRECTORY=' $MAXIMA | sed -e
's/MAXIMA_DIRECTORY=//'`
if [ -f "$MAXIMA_DIRECTORY/doc/html/maxima_toc.html" ]
then echo "\"$MAXIMA_DIRECTORY/doc/html/maxima_toc.html\""
elif [ -f "$MAXIMA_DIRECTORY/info/maxima_toc.html" ]
then echo "\"$MAXIMA_DIRECTORY/info/maxima_toc.html\""
else echo '#f'
fi
else
# resorting to locate
MAXIMA_HELP=`locate maxima_toc.html`
if [ $? -eq 0 ]
then
MAXIMA_HELP2=`echo "$MAXIMA_HELP" | grep -F /doc/html/maxima_toc.html`
if [ $? -eq 0 ]
then MAXIMA_HELP="$MAXIMA_HELP2"
else
MAXIMA_HELP2=`echo "$MAXIMA_HELP" | grep -F /info/maxima_toc.html`
if [ $? -eq 0 ]
then MAXIMA_HELP="$MAXIMA_HELP2"
fi
fi
MAXIMA_HELP2=`echo "$MAXIMA_HELP" | grep '^/usr'`
if [ $? -eq 0 ]
then MAXIMA_HELP="$MAXIMA_HELP2"
fi
echo "$MAXIMA_HELP" | sed -e 's/^/"/' -e 's/$/"/' -e '1s/^/(/' -e
'$s/$/)/'
else echo '#f'
fi
fi
}

# maximum version
V1=0; V2=0; V3=0

max_ver() {
while [ -n "$1" ]; do
if [ $1 -gt $V1 ]
then V1=$1; V2=$2; V3=$3
elif [ $1 -eq $V1 ]
then
if [ $2 -gt $V2 ]
then V2=$2; V3=$3
elif [ $2 -eq $V2 ]
then
if [ $3 -gt $V3 ]
then V3=$3
fi
fi
fi
shift; shift; shift
done
}

if [ $OSTYPE = "cygwin" ] ; then EXT='.bat'; else EXT=''; fi
MAXIMA=`which maxima$EXT 2>/dev/null`
if [ $? -eq 0 ]
then
if [ $OSTYPE = "cygwin" ]
then
if [ "$1" ]
then
maxima -d | grep -F 'maxima-htmldir=' | \
sed -e 's/maxima-htmldir=/"/' -e 's|$|/maxima_toc.html"|' | \
cygpath -f -
else
echo '("cygwin")'
fi
else
if grep -F list-avail $MAXIMA >/dev/null
then
# 5.9.0 or later
if [ "$1" ]
then
max_ver `maxima --list-avail | \
grep '^version [A-Za-z0-9\.]\+, lisp [A_Za-z0-9]\+$' |\
sed -e 's/^version \([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1 \2
\3/'`

GOOD=no
if [ $V1 -gt 5 ]
then GOOD=yes
elif [ $V1 -eq 5 ]
then
if [ $V2 -gt 9 ]
then GOOD=yes
elif [ $V2 -eq 9 ]
then
if [ $V3 -gt 0 ]
then GOOD=yes
fi
fi
fi

if [ $GOOD = yes ]
then
# 5.9.1 or later
maxima -d | grep -F 'maxima-htmldir=' |\
sed -e 's/maxima-htmldir=/"/' -e 's|$|/maxima_toc.html"|'
else
# 5.9.0
find_old_help
fi
else
echo '('
maxima --list-avail |\
grep '^version [a-z0-9\.]\+, lisp [a-zA-Z0-9]\+$' |\
sed -e 's/^version \([a-z0-9\.]\+\), lisp \([a-zA_Z0-9]\+\)$/"\1
\2"/'
echo ')'
fi
else
# 5.6
if [ "$1" ]
then
find_old_help
else
if grep -F clisp $MAXIMA >/dev/null
then echo '("5.6 clisp")'
else echo '("5.6 gcl")'
fi
fi
fi
fi
else
# maxima not found
echo '#f'
fi
#!/bin/sh

TEXMACS_MAXIMA_PATH="$TEXMACS_PATH/plugins/maxima/lisp"
export TEXMACS_MAXIMA_PATH

case $1 in
cygwin) exec maxima.bat -p "`echo
$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.11.0.lisp|cygpath --windows -f -`";;
5.6)
case $2 in
gcl) exec maxima -load "$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.6.lisp" \
| maxima_filter;;
clisp) exec maxima -i "$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.6.lisp" \
| maxima_filter;;
esac;;
5.9.0) exec maxima -u $1 -l $2 -p
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.0.lisp" | maxima_filter;;
5.9.1*) exec maxima -u $1 -l $2 -p
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.1.lisp";;
5.9.2* | 5.9.3*) exec maxima -u $1 -l $2 -p
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.9.2.lisp";;
5.10.*) exec maxima -u $1 -l $2 -p
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.10.0.lisp";;
*) exec maxima -u $1 -l $2 -p
"$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.11.0.lisp";;
esac



Archive powered by MHonArc 2.6.19.

Top of Page