This project provides the functionality to use GNU TeXmacs as the frontend of Wolfram language.
- Breaking change: Magic line style changed from
% -width 400to
(** width:400px **)Note that you need to specify
pxif what you want is in number of pixels. - You can now use
%or%nto refer to previous output. As usual, output prompt, whose index is the same as the input prompt index, won’t be printed when there’s a single output.
Adapt mogan.
Add a more consistent code dumping script bin/tmdumpcode1 using
TeXmacs scheme. Look into and use it at your own risk.
Introduced some syntax highlight Elements. If you want to enable
it, add to you init file my-init-texmacs.scm:
(lazy-format (mma-format) mma)Formula input is still buggy as of now. I’m too busy to get some time fixing it. If you have trouble with that, just don’t use it.
You can now enter math formulus in a mathematica session, type $ followed by tab to enter math
environment! This is especially useful when you need to manually do some manipulations on the
results returned by mathematica, or to copy from somewhere else within TeXmacs.
At present only a limited set of math formulus can be remapped to mathematica functions. Look into
mw-converter.scm for details. Since all this function does is to map string snippet, it’s hard
to define a standard remap rules set for everyone. Anyway, you can hack and tailor it to your own
use case.
NOTE: You need to take care of what you type in a math environment. Basically the process is:
math env -> texmacs routine -> string match and replace, so use math env only for formulus if you have
little knowledge on TeXmacs internals and don’t want to make your hands dirty.
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.
