LaTeX labels in Maxima plots



Rayne Olivetti <rayneolivetti at yahoo.com> writes:

> This is something very desirable for articles. (a Mathematica version can be found here: http://wwwth.mpp.mpg.de/members/jgrosse/mathpsfrag/)
>
> Currently, I can get output with LaTeX output with something like this:
>
> plot2d([sin(x)], [x,-5,5],[y,-5,5],[gnuplot_term, latex], [gnuplot_out_file, "~/graph.tex"],[xlabel, "$\\alpha$"],[ylabel,"$\\sin(\\alpha)$"]);
>
> then I will need to wrap it in a LaTeX file, like this
>
> \documentclass[letterpaper,10pt]{scrartcl}
>
> \usepackage[latin1]{inputenc}
> \usepackage{amsfonts}
> \usepackage{amsmath}
> \usepackage{amssymb}
> \usepackage{amsthm}
> \usepackage[T1]{fontenc}
> \usepackage[dvips]{graphicx}
>
>
> \begin{document}
> \thispagestyle{empty}
> \pagestyle{empty}
> \begin{figure}
>   \input{graph}
> \end{figure}
> \end{document}
>
> and run LaTeX externally to see a plot with LaTeX labels.
> It'd be nice if there was a way of doing this in a more integrated fashion.

How about:

plot2d_with_latex_labels([args]) := block([outfile:"/tmp/graph.tex",pdffile:"/tmp/graph.pdf"],
 print_latex_boiler_plate(outfile),
 apply(plot2d,args),
 system(concat("pdflatex ",outfile," && xpdf ",pdffile)));

and print_latex_boiler_plate does what it says.

-- 
Leo Butler                      nb0yjxtr at sdf.lonestar.org
SDF Public Access UNIX System -   http://sdf.lonestar.org