2

I would like to use plots created with Mathematica inside my LaTeX environment. Is it possible to plot the Mathematica code completely inside the LaTeX environment?

If it is not possible, does anyone know a good way to implement the Mathematica plots inside my .tex file?

The simplest way is a simple .png export and \includegraphics but the resolution of the picture is not satisfying.

\documentclass[a4paper,pagesize ,landscape, fontsize=5pt, fleqn]{scrartcl}

\usepackage[left=0.75cm,right=0.75cm, top=0.75cm, bottom=1cm]{geometry}
\usepackage{multicol}
\usepackage{amsmath, amsfonts, amssymb}
\usepackage{bbm}
\usepackage[svgnames,table,hyperref]{xcolor}
\usepackage{tikz}
\usepackage{array,multirow}
\usepackage[T1]{fontenc}
\usepackage{tabularx}

\pagestyle{plain}
\setlength{\columnsep}{30pt}
\setlength{\columnseprule}{0.4pt}

\begin{document}

\begin{multicols*}{3}

torus

\[\text{parametric: } \vec{r}(u, v) = \begin{pmatrix}(c + a\cos(v))\cos(u) \\ (c + a\cos(v))\sin(u) \\ a\sin(v) \end{pmatrix} \hspace{5mm} u, v \in[0, 2\pi)\]
\[\text{implicit: }\left(c - \sqrt{x^2 + y^2}\right)^2 + z^2 = a^2\]

%here should be the 3D plot.%

\end {multicols*}
\end{document} 

And this would be the parametric plot created with Mathematica

ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2*Pi}, {v, 0, 2*Pi}]
2

You simply save your Mathematica notebook as a Latex file. All the graphics will generate eps files. Then just add:

\usepackage{epstopdf}

You'll be able to use pdflatex.

Here's a useful link: http://reference.wolfram.com/language/howto/GenerateTeXWithTheWolframLanguage.html

  • Basically what I was looking for. Thanks Mary :) – montju Dec 16 '14 at 22:14
  • No problem! Glad I could help. – Mary Dec 16 '14 at 22:27
2

1. AFAIK it is not possible to run Mathematica codes inside LaTeX.

2. Export the picture as PDF.

See the image below. You can do it easily with mouse.

enter image description here

  • Well my current solution is the export to a .png/.pdf and include it into my .tex file. – montju Dec 16 '14 at 18:39
  • It would have been a more elegant way of using my plots:) – montju Dec 16 '14 at 18:40
  • @montju, this is the single solution. Or you can try to plot using another tool: gnuplot, for example. – Sigur Dec 16 '14 at 18:42
  • I already considered this solution - using a tool inside of LaTeX. But I think I will stick with the .pdf export solution for the moment. Easy and the results are good :) – montju Dec 16 '14 at 18:44
  • 1
    Mathematica has a command line interface, so it is possible to do it from one go if you want to cheat. – Sean Allred Dec 16 '14 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.