SympyTeX - a latex package for working with sympy in LaTeX

194 views
Skip to first unread message

t...@physics.otago.ac.nz

unread,
May 17, 2009, 8:09:23 PM5/17/09
to sympy
Hi

Sympy is GREAT. I've created a Latex package that automatically
includes sympy output from code blocks embedded
into a document. (its a shameless ripoff of the SageTeX package)

<example>
Using sympy within your \LaTeX document is as easy as $2+2=\sympy
{2+2}$.

You can write a block, and then use the variables defined later in
your code!
\begin{sympyblock}
x = sympy.Symbol('x')
h = sympy.integrate(1+x,x)
\end{sympyblock}
The variable $h$, how can be called using {\verb \sympy{h} }, and you
will get $h = \sympy{h}$. Similarly, the integral of $1+x^4$ is $\sympy
{sympy.integrate(1+x**4,x)}$.
</example>

I find it quite useful, and wondered whether any other folk on this
list might be interested in using it. I have a temporary home for it
at
http://elec.otago.ac.nz/w/index.php/SympyTeX

I must confess to being a LaTeX beginner and python newbie, so please
excuse in advance the poor state of the code and documentation.

Cheers

Tim

Ondrej Certik

unread,
May 17, 2009, 9:23:33 PM5/17/09
to sy...@googlegroups.com
Hi Tim!

On Sun, May 17, 2009 at 5:09 PM, t...@physics.otago.ac.nz
<t...@physics.otago.ac.nz> wrote:
>
> Hi
>
> Sympy is GREAT. I've created a Latex package that automatically
> includes sympy output from code blocks embedded
> into a document. (its a shameless ripoff of the SageTeX package)
>
> <example>
> Using sympy within your \LaTeX document is as easy as $2+2=\sympy
> {2+2}$.
>
> You can write a block, and then use the variables defined later in
> your code!
> \begin{sympyblock}
> x = sympy.Symbol('x')
> h = sympy.integrate(1+x,x)
> \end{sympyblock}
> The variable $h$, how can be called using {\verb \sympy{h} }, and you
> will get $h = \sympy{h}$. Similarly, the integral of $1+x^4$ is $\sympy
> {sympy.integrate(1+x**4,x)}$.
> </example>
>
> I find it quite useful, and wondered whether any other folk on this
> list might be interested in using it. I have a temporary home for it
> at
> http://elec.otago.ac.nz/w/index.php/SympyTeX

Awesome, that's excellent! Thanks for sharing that.

>
> I must confess to being a LaTeX beginner and python newbie, so please
> excuse in advance the poor state of the code and documentation.

I am also not really an expert in latex, so here is what I did:

$ git clone git://github.com/tmolteno/SympyTeX.git
$ cd SympyTeX
$ latex sympytexpackage.ins
$ latex example.tex
[...]
(/etc/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))

! LaTeX Error: File `makecmds.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Am I missing some latex package? Or should I run some other command to
install sympytex.

Ondrej

cch

unread,
May 17, 2009, 10:43:18 PM5/17/09
to sympy
You can get makecmds packages from www.ctan.org (or via google search)

Put makecmds.sty in $texmf search path, for instance, put it in the
following folder:

/usr/share/texmf/tex/latex/makecmds

and then execute

> texhash

to refresh the latex search path.

cch


Tim Molteno

unread,
May 17, 2009, 11:02:08 PM5/17/09
to sy...@googlegroups.com, Ondrej Certik
I think that this can be resolved by

aptitude install texlive-latex-extra

I'll update the README.

Cheers

Tim


On Mon, 18 May 2009, Ondrej Certik wrote:
>
> I am also not really an expert in latex, so here is what I did:
>
> $ git clone git://github.com/tmolteno/SympyTeX.git
> $ cd SympyTeX
> $ latex sympytexpackage.ins
> $ latex example.tex
> [...]
> (/etc/texmf/tex/latex/config/graphics.cfg)
> (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))
>
> ! LaTeX Error: File `makecmds.sty' not found.
>
> Type X to quit or <RETURN> to proceed,
> or enter new name. (Default extension: sty)
>
>

--
-------------------------
Dr T.C.A. Molteno
Electronics Research
Department of Physics
University of Otago
http://www.physics.otago.ac.nz/elec/

signature.asc

François Bissey

unread,
May 17, 2009, 11:03:19 PM5/17/09
to sy...@googlegroups.com
On Mon, 18 May 2009, Ondrej Certik wrote:
This is provided by texlive-latexextra on Gentoo not sure on other distro.
Of course you can download from ctan and install it yourself but that may
not be the best course of action.

Francois

Reply all
Reply to author
Forward
0 new messages