LaTeX package that embeds and executes Wolfram Language (Mathematica) codes inside LaTeX documents

License: LPPL-1.3c

Language: TeX

Keywords: latex-package, mathematica, wolfram-alpha


CTAN Travis

LaTeX-α2 (latexalpha2) is a LaTeX package that can execute Wolfram Language codes and show the corresponding results inside LaTeX documents.

The package is heavily inspired by LaTeX-Alpha. Unfortunately, LaTeX-Alpha has been down for a while. The aim of this package is to replace LaTeX-Alpha, as well as to provide various new features.

The codes can be executed either locally (via locally installed Mathematica) or on the cloud (via Wolfram Cloud) using the WolframScript interpreter. In addition, you can also use Mathics (a free, open-source alternative to Mathematica) for computations.

The package only supports Unix-like system for now. Pull requests are welcome.


  • First install WolframScript (or Mathics) if you haven't already done so. You can use type wolframscript or type mathics to check if it's properly installed.

  • Download latexalpha2.sty to the same folder as your .tex file:

curl -O

To avoid copying the file every time, please see the installation guide below.

  • Add \usepackage{latexalpha2} to the preamble of your document. All the codes will be run locally by default. If you'd like to run on the cloud, use \usepackage[cloud]{latexalpha2} instead. For the Mathics mode, use \usepackage[mathics]{latexalpha2}.

  • LaTeX must be invoked with the -shell-escape flag in order to run WolframScript (or Mathics). For example: pdflatex -shell-escape example.tex.

Please refer to the documentation for more information.








    \wolframgraphics[pdf]{Plot3D[Sin[x]Cos[y], {x, -2Pi, 2Pi}, {y, -2Pi, 2Pi}]}{example}
    \caption{Plot of $f(x,y)=\sin(x)\cos(y)$}


Example Plot


    \wolframgraphics[pdf]{GeoGraphics[{Red,Thick,GeoPath["DateLine"]},GeoRange->{All, {90, 270}},GeoGridLines->Quantity[15, "AngularDegrees"]]}{example2}
    \caption{International Date Line}


Example Plot 2



The population of Shanghai is $\wolframalpha{population of Shanghai}$, which is $\wolframalpha{ratio of Shanghai populatioin and NYC population}$ times the population of New York City.


The population of Shanghai is 2.415×107 people, which is 2.814 times the population of New York City.


$\wolframalpha{Compton scattering for electron}$








    \wolframtable{Join[{{x,x^2,x^3}}, Table[{i,i^2,i^3},{i,5}]]}


Example Plot 3


To avoid copying the latexalpha2.sty file for every new project, you could install the package instead. Just put the .sty file in the texmf/tex/latex folder (for TeX Live, it would be /usr/local/texlive/texmf-local/tex/latex by default), and then run sudo hexhash to update the package database. For more information, please refer to LaTeX/Installing Extra Packages.


This work is distributed under the LaTeX Project Public License (LLPL), version 1.3c.

Project Statistics

Sourcerank 4
Repository Size 2.66 MB
Stars 28
Forks 1
Watchers 3
Open issues 1
Dependencies 0
Contributors 1
Tags 1
Last updated
Last pushed

Top Contributors See all

Yi Liu

Recent Tags See all

v1.0 March 03, 2019

Something wrong with this page? Make a suggestion

Last synced: 2019-04-07 01:57:55 UTC

Login to resync this repository