4

I was not sure if I should ask this on Mathematica or LATEX or here.

I am very new to LATEX and using \includegraphics to put images into my paper. I am using plots generated in Mathematica as PDF's. After I compile the tex file and get a PDF the plots look nice but the labels for the X and Y axis are missing.

I have added \pdfoptionpdfminorversion 6 to my preamble because I was getting an error about the version of the PDF's. The error is gone but still no labels.

Any thoughts? Ben

migrated from stackoverflow.com Jan 7 '14 at 12:19

This question came from our site for professional and enthusiast programmers.

  • 3
    You may have to select a setting in Mathematica to include/embed the fonts in the exported PDF. – Werner Jan 6 '14 at 19:05
  • The title is misleading. You get the PDFs but no labels, right? If that is correct, that is what you should say. – Faheem Mitha Jan 7 '14 at 14:06
  • Welcome to TeX.SX! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Reinstate Monica - M. Schröder Jan 8 '14 at 9:54
  • By paper you mean publication? Independent of the solution to your actual problem, try not to use Mathematica for labeling for publication quality figures, concerning typesetting rules on italics/non-italics, usually something goes wrong. Put the labels in latex: PSTricks or PDFTricks. Like this your labels are truly identical to what you put in the text of your manuscript. It is a little bit more work but looks much better. – mikuszefski Jan 8 '14 at 16:21
1

I guess the PDF generated by Mathematica contains the labels correctly, but after including them in the *.tex file and compiling it, the labels are gone, right?

Does it help to put as first line of the tex-file the command \pdfinclusioncopyfonts=1?  

By the way, usually PDFs are included using the package pdfpages, please read the manual. You get it after typing texdoc pdfpages on the commandline. OK, if you use texlive. With miktex I forgot.

1

There are some good Q / A's about this topic on Mathematica, here, here and here. Anyway, in Mathematica you have to include the "FontFamily" with "BaseStyle" and you have to do a clean export. See Example;

plotWithLegend = 
  ListPlot[Table[f, {f, {Sin[x], Cos[x]}}, {x, 0, 2 \[Pi], 0.1}], 
   Frame -> True, PlotLegends -> {"sin(x)", "cos(x)"}, 
   FrameLabel -> "Frame label font size is about 8 pt", 
   ImageSize -> 200, 
   BaseStyle -> {FontFamily -> "Times", FontWeight -> "Bold", 
     FontSize -> 12}];
Export["plotWithLegend.pdf", plotWithLegend]

Runs well on OSX with latexmk

\documentclass[11pt, oneside]{article}                          
\usepackage{graphicx}               
\title{Brief Article}
\author{The Author}

\begin{document}

\begin{figure}[htbp]
   \centering
   \includegraphics[width=4in]{plotWithLegend.pdf} 
   \caption{example caption}
   \label{fig:example}
\end{figure}

\end{document}  

Your Answer

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