This project provides the functionality to use GNU TeXmacs as the frontend of Wolfram language.
Maintaining two branches is burdensome. Personally I don’t use this branch anymore. Writing wolfram
language is much more easier than C++, also performance difference can be ignored if you don’t do crazy
things requiring massive memory management in such an embeded calculator. Further
features to the branch wolframscript will not be ported to this branch. You can fork apply them
yourself if you want.
Your codes now can be indented automatically.
Outputname prefix like Out[12]= now will not be displayed only when there is one single return,
which is really useful for that wrapped in a executable fold, e.g. a figure in the demo.
Added a python script to dump all codes within mma sessions of a .tm file to a .m file. This will be
helpful if you want to collect all codes for some specific use case. Run:
# if path of this script is already added to $PATH
# use an alias or different link name if you like
tmdumpcode <path to .tm file like rep.tm> [<target .m file like rep-out.m>]Then rep-out.m (or rep.m if no target is specified) will appear in your current directory.
⚠️NOTE: This will override your target file. Be careful!
One night I wanted to neither read books nor sleep, then I rewrote this project.
Now % like that in notebook frontend is supported, and, the logic of format and inter-communication
is clarified. (Though it’s possible to write %12, I personally recommend you not to do like this,
since each time codes are rerun, indices will most probably change.)
There are two versions of this plugin. One (main branch) is implemented in cpp utilizing the WSTP interface,
the other (wolframscript branch) is implemented in Wolfram language and run as a wolfram script. The
first one has interactive features like % as last output, while the second one works out of the box
and require no cpp compilation toolchain.
Check wolframscript branch for details.
TeXmacs use the dirname in plugins to mark the name of a plugin. To use two branches simultaneously, you
need to hold one copy of files and manually rename something. Say you will name it myplugin, confirm:
- dirname in
$HOME/.TeXmacs/pluginsto bemyplugin(mma by default) - filename in
$HOME/.TeXmacs/plugins/myplugin/progsto be init-myplugin.scm (init-mma.scm by default) - names of functions in
init-myplugin.scm(look into the code and you will figure out what to do)
NOTE: This one is tested against ArchLinux and OSX 10.15.
To use this plugin, you need compile it manually since it rely on the WSTP library shipped with your Wolfram.
C++ compilation toolchain is required.
Confirm the directory of WolframKernel is in PATH, type which WolframKernel to check it. Then:
cd $HOME/.TeXmacs/plugins/
git clone https://github.com/hammerfunctor/tm-mathematica mma && cd mma
./build.sh # or: `WOLFRAM_PATH=/path/to/wolframproduct ./build`If no error is reported, then next time when you start TeXmacs, this plugin will be available.
On Windows, you need to add the directory of wolframscript.exe to environment variable Path. It may be like
C:\Program Files\Wolfram Research\Mathematica\13.0\ for Mathematica
and C:\Program Files\Wolfram Research\WolframScript\ for WolframEngine
(select to enable the extra component wolframscript when installing WolframEngine).
Then enter following in CMD (git is needed. If you don’t have git, click in github page to switch to wolframscript
branch, download it as a zip file and put it in your TeXmacs plugin directory and name the directory mma)
cd %AppData%/Roaming/TeXmacs/plugins
git clone https://github.com/hammerfunctor/tm-mathematica mma
cd mma && git checkout wolframscriptOn Linux and macOS, find the directory of wolframscript and add it to PATH. Then
cd $HOME/.TeXmacs/plugins
git clone https://github.com/hammerfunctor/tm-mathematica mma
cd mma && git checkout wolframscriptOn Windows once you add the dir to environment variable PATH, texmacs will correctly recognize this plugin after it read PATH.
For OSX and Linux the PATH texmacs get to know is a bit tricky. On Linux the login-shell init file, say $HOME/.zprofile
(if you use zsh) is perhaps respected. You can add one line export PATH=$PATH:/path/to/wolframscript to your .zprofile
(or .profile if you don’t use zsh).
On OSX texmacs is aware of the existence of .zprofile if you start it from terminal, while not if you run texmacs from
spotlight search. One workaround is to link /usr/local/bin/wolframscript to /path/to/wolframscript, which is always in PATH.
