2

I have some plot

Plot[a, {a, -6, 6}]

enter image description here

I need to use it in Latex. However the problem is that labeling text style in Mathematica does not match with LaTeX text. So what I do, I copy the figure without labels from Mathematica as enter image description here

\documentclass[a4paper,pra,preprint]{revtex4}
\usepackage{graphicx}

     \begin{document}
\setlength{\unitlength}{2cm}
 \begin{picture} (6,5)


\put(5.12,1.15){$0$}

\put(3.0,2.6){$0.3$}
\put(3.0,3.85){$0.6$}


\put(3,1){\includegraphics[width=8cm,height=6cm]{a2.png} }
 \put(2.9,2.15){$-6$} 
 \put(6.9,2.15){$6$} 
 \put(4.8,3.9){$6$}
  \put(4.8,1.0){$6$}
\end{picture}
\end{document}

and place labels manually in LaTeX as enter image description here

As there is a clear difference in label style fonts. This technique is not only tiring but it will not support me to save the labeled figure in .png or .eps format. Rather it will be a .pdf generated. Is there a way to match the label font style and size of labeling text in Mathematica?

  • 2
    There's no general solution to this sort of tool mismatch - your options are (a) either to set up Mathematica to match your Latex style or (b) to redraw your graphs using one of the (many) Latex-friendly systems, like pgfplots. Assuming that you are doing rather more complex graphs than your example, you might find (a) easier. If you can use xelatex or lualatex you would be able to use the same system fonts in both Mathematica and LaTeX, which also might make (a) the better option. – Thruston Feb 26 '15 at 11:50
  • You can open the pdf-file in Inkscape and export it as PDF+LaTeX, which replaces the text with LaTeX-Text, so you automatically get the same fonts in your document. – Juri Robl Feb 27 '15 at 18:22
3

I found the solution actually. By selecting the Font Style of Times Roman in MikteX by using package

mathptmx

And by selecting Label style in Mathematica as

LabelStyle -> Directive[ FontFamily -> "Times"]

worked for me.

0

You can use the MaTeX Mathematica package to generate figure labels with LaTeX in Mathematica. This is described here:

How to match font sizes is a slightly different topic and is explained here:

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.