Group Abstract Group Abstract

Message Boards Message Boards

Displaying graphics and images inline on Wolfram Engine

11 Replies
Posted 1 month ago

A major update to the sci-wolfram package (formerly Wolfram-terminal-image)

See https://github.com/TurbulenceChaos/sci-wolfram

Features for emacs

  • [o] Automatically read wolfram symbols from built-in LSPServer package and convert them to emacs variables.
  • [o] Add wolfram symbols to completion-at-point when lsp server is not available;
  • [o] Use CodeFormatter to format code when lsp server is not available;
  • [o] Add LSPServer to eglot or lsp-mode to support code formatting and completion;
  • [o] Execute wolfram script and display images and latex in tmp buffer;
  • [o] Convert wolfram script to pdf and Mathematica notebook, and use Wolfram Player to view notebook;
  • [o] jupyter-Wolfram-Language src-block in org-mode: find doc, completion-at-point, format, convert to pdf and notebook;
  • [o] Send wolfram script to jupyter repl, and display images in it;
  • [o] Insert sci-wolfram-image.wl package based on your emacs config;
  • [ ] Execute wolfram script based on jupyter-eval when jupyter repl is started;
  • [o] Add more wolfram symbols to font-lock-keywords.
  • [o] Add prettify symbols to sci-wolfram-mode

Features for vscode

  • [o] Display wolfram script images in vscode terminal using imgcat;
  • [o] Convert wolfram script to pdf and Mathematica notebook, and use Wolfram Player to view notebook;
POSTED BY: Peng Peng
Posted 3 months ago
Posted 3 months ago

Thanks for sharing! Inspired by your code, I developed the Wolfram-terminal-image package to display Wolfram Mathematica graphics in the vscode terminal and emacs org-mode (dynamic plots can be interacted via Wolfram Player).

For vscode, both formulas and plots are converted into .png files and shown in terminal using imgcat.

Demo: Test-vscode-terminal-wolfram-mathematica.gif Testing wolfram mathematica in vscode terminal

For emacs org-mode, formulas are converted into LaTeX fragments by default, making it easy to paste them into Microsoft Word or LaTeX. You can place the cursor on a formula and press C-c C-x C-l to toggle it preview.

Print["\\begin{equation*}\n" <> ToString[TeXForm[expr]] <> "\n\\end{equation*}"];

Demo: Test-emacs-jupyter-wolfram-mathematica.gif Testing wolfram mathematica in emacs org mode

POSTED BY: Peng Peng

Thanks for this post!

Wanted to add that Kitty (alternative to iTerm2) also offers a similar feature. To obtain the same results with Kitty, one can replace Run["imgcat " <> fileName] in the module with Run["kitten icat " <> fileName].

Details could be found at https://sw.kovidgoyal.net/kitty/kittens/icat/

POSTED BY: Sudeepan Datta
Posted 1 year ago

Nice! Thanks for sharing.

You may also create a RAM disk to house your temporary directory.

POSTED BY: James Wey

Cool. I don't know if it's a bad idea or not, but you could make this even more streamlined by setting something like:

$Post = Replace[#, {Alternatives[_Graphics, _Image] :> qView[#]}] &

so that Graphics and Image expressions (and/or whatever else you want) pass through qView automatically? (i.e. saves the effort of typing //qView after each input)

POSTED BY: Josh Lietz

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

Hi Cornel,

I am not there yet. With the setup described here, it is only possible to display static content. Manipulate, Animate contian Dynamic functions that require the frontend.

Hi Rohit,

Thank you for the suggestion. I will look it up and see how it can fit in.

Posted 2 years ago

Is it possible to rotate 3D plot and to use manipulate and animation in terminal with what you said now?

POSTED BY: Cornel B.
Posted 2 years ago

Hi Soumya,

This is nice, thanks for sharing. BTW, you can use CreateFile[] to create a unique file in $TemporaryDirectory.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard