4

How can I insert this Mathematica plot in LaTex as a figure?

enter image description here

MWE:

\documentclass[12pt, a4paper]{report}
    \usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{epstopdf}
\usepackage{latexalpha2}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\wolframgraphics{Plot[{Log[ x], 1*(x - 1), 1.5*(x - 1), 2*(x - 1), 2.5*(x - 1), 
  3*(x - 1)}, {x, 0, 1}, ImageSize -> 750, 
 PlotStyle -> {{Blue, Thick, Dashing[None]}, {Red, 
    Dashing[None]}, {Black, Dashing[None]}, {Black, 
    Dashing[None]}, {Black, Dashing[None]}, {Black, Dashing[None]}}, 
 Frame -> {{True, False}, {False, True}}, 
 FrameLabel -> {{"y", None}, {None, "Fraction susceptible"}}, 
 FrameTicks -> All, AxesOrigin -> {0, -4}]}{SIR without vital dynamics picture}
\includegraphics{SIR without vital dynamics picture.pdf}
\caption{Plot of $f(x,y)=\sin(x)\cos(y)$}
\centering
\end{figure}

\end{document}

EDIT:

Is this the woflramScript?

enter image description here

Errors:

enter image description here

Using the PDF method(I stretched the image), I have the following:

enter image description here

13
  • 2
    You might want to take a look at en.wikibooks.org/wiki/LaTeX/Importing_Graphics.
    – campa
    Commented Jun 14, 2021 at 11:10
  • 2
    You can considerate to use also this specific package for Wolfram Language : latexalpha2. I add the link: ctan.math.illinois.edu/macros/latex/contrib/latexalpha2/….
    – Sebastiano
    Commented Jun 14, 2021 at 11:16
  • 1
    @Sebastiano : I get this error when trying to use the package you mention: "! Package latexalpha2 Error: Shell escape is not enabled, which is required to use latexalpha2."
    – Math
    Commented Jun 14, 2021 at 11:22
  • 1
    @Math The reason can be anything: if you have installed the package, what is the your LaTeX distribuition, etc. Please, can you add your minimal working example with more informations? Thank you very much.
    – Sebastiano
    Commented Jun 14, 2021 at 11:27
  • 1
    @Sebastiano Added
    – Math
    Commented Jun 14, 2021 at 11:30

1 Answer 1

4

Use latexalpha2wlua.sty from latexalpha ported to windows

(1) Wolfram Engine must be installed and wolframscript must be fully working on the command prompt! (free version). WolframScript (for the Command Line)

Try wolframscript -version. You should get WolframScript 1.5.0 for Windows-x86-64 or similar.

(2) The file latexalpha2wlua.sty should be in the same directory of the .tex document.

(3) latexalpha2wlua loads all the necessary packages for this graph.

a

\documentclass[12pt, a4paper]{report}

\usepackage{latexalpha2wlua}

\begin{document}    

\wolframgraphics{Plot[{Log[ x], 1*(x - 1), 1.5*(x - 1), 2*(x - 1), 2.5*(x - 1), 
        3*(x - 1)}, {x, 0, 1}, ImageSize -> 750, 
    PlotStyle -> {{Blue, Thick, Dashing[None]}, {Red, 
            Dashing[None]}, {Black, Dashing[None]}, {Black, 
            Dashing[None]}, {Black, Dashing[None]}, {Black, Dashing[None]}}, 
    Frame -> {{True, False}, {False, True}}, 
    FrameLabel -> {{"y", None}, {None, "Fraction susceptible"}}, 
    FrameTicks -> All, AxesOrigin -> {0, -4}]}{SIR.pdf}
        
\begin{figure}
    \centering
        \includegraphics[scale=.7]{SIR.pdf}
        \caption{Plot of $f(x,y)=\sin(x)\cos(y)$}
        \centering
\end{figure}    

\end{document}

UPDATE

Configure your tex editor:

pdflatex: => pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape %.tex

or

lualatex: => lualatex.exe -synctex=1 -interaction=nonstopmode -shell-escape %.tex

TeXstudio: Options > Configure TexStudio

ts

Then > Build & View or F5

ts2

Texmaker: Options > Configure Texmaker

tm

Then > Run

TM2

23
  • I'm a amateur in computing so I'm a bit lost :( What am I supposed to do?
    – Math
    Commented Jun 14, 2021 at 14:45
  • @Math If you handle Mathematica, you are way ahead! Download and install the free version of wolframscript. It will install the Wolfram Engine on your machine at the same time. You will be asked to register and will receive a free license. Open the windows command (cmd.exe) and at the command prompt (like c:> in Windows) type wolframscript -version to test that the installation is ok and activated. It takes several seconds to answer the first time. Follow up to step 2. Commented Jun 14, 2021 at 15:12
  • for some reason its blocked on my university PC. I will try get it sorted out soon then message back! thank you for your answer by the way :)
    – Math
    Commented Jun 14, 2021 at 15:22
  • @Math If you are using the Mathematica license of the uni ask how to run wolframscript from the PC. Commented Jun 14, 2021 at 15:26
  • I will ask., thank you!
    – Math
    Commented Jun 15, 2021 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .