:

## Include active Maple code within LaTeX documents

Maple

Here is a simple collection of Python scripts that allows Maple code to be embedded directly within a LaTeX document. The scripts will process the LaTeX document, calling Maple as required, making the Maple output directly accessible in the LaTeX document. The source, including extensive examples, can be found at https://github.com/leo-brewin/hybrid-latex. This  library also supports inclusion of active Mathematica, Matlab, Python and Cadabra code within LaTeX documents.

Here is a simple example (based on maple/example-01 in the GitHub site)

\documentclass[12pt]{mpllatex}

\begin{document}

\section*{Calculus}

\begin{maple}
ans := diff(x*sin(x),x):                          # mpl (ans.501,ans)
ans := eval(diff(x*sin(x),x),x=Pi/4):             # mpl (ans.502,ans)
ans := int(2*sin(x)^2, x=a..b):                   # mpl (ans.503,ans)
ans := int(2*exp(-x^2),x=0..infinity):            # mpl (ans.504,ans)
ans := ''int(2*exp(-x^2),x=0..infinity)'':        # mpl (lhs.504,ans)
ans := int(int(x^2 + y^2,  y=0..x),x=0..1):       # mpl (ans.505,ans)
ans := ''int(int(x^2 + y^2,  y=0..x),x=0..1)'':   # mpl (lhs.505,ans)
\end{maple}

\begin{align*}
&\mpl*{ans.501}\\
&\mpl*{ans.502}\\
&\mpl*{ans.503}\\
\mpl{lhs.504}&=\Mpl{ans.504}\\
\mpl{lhs.505}&=\Mpl{ans.505}
\end{align*}

\end{document}


and here is the corresponding output

example-01.pdf

﻿