logithm / latex-alpha2

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LaTeX-α2

CTAN

LaTeX-α2 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.

Usage

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

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

curl -O https://raw.githubusercontent.com/stevenliuyi/latex-alpha2/master/latexalpha2.sty
  • 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.

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

Please refer to the documentation for more information.

Examples

\wolfram{}

Input:

$\wolfram{Series[Exp[x],{x,0,5}]}$

Output:

\wolframgraphics{}

Input:

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

Output:

Example Plot

Input:

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

Output:

Example Plot 2

\wolframalpha{}

Input:

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.

Output:

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

Input:

$\wolframalpha{Compton scattering for electron}$

Output:

\wolframdsolve{}

Input:

\wolframdsolve{y'[x]+y[x]==a*Sin[x]}{y[x]}{x}

Output:

License

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

About

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

License:LaTeX Project Public License v1.3c


Languages

Language:TeX 100.0%