[Tex/LaTex] Exporting graphs from Mathematica to LaTex document

graphsscriptswolfram-mathematica

Matlab has Matlab2Tikz while open for Mathematica2Tikz, more here. How can I export graphs such as Harary graphs from Mathematica to LaTex?

Example graph generated in Mathematica without finding support to export to LaTex.

enter image description here

Best Answer

It can be done using wolframscript and latexalpha2wlua.sty

See https://tex.stackexchange.com/a/579254/161015 for a complete answer.

hh

\documentclass[12pt,a4paper]{article}

\RequirePackage[cache]{latexalpha2wlua} % option cache (faster on the second run) or nocache (recalculate always)

\begin{document}
    
\begin{figure}
    \wolframgraphics{Table[HararyGraph[i, 8, PlotLabel -> Subscript[H, i, 8]], {i, 2, 4}]}{HararyGraph} % default: pdf output
    \includegraphics{HararyGraph.pdf}
    \caption{Plot of HararyGraph from pdf}
    \centering
\end{figure}    

\end{document}