3
$\begingroup$

I use the following code:

sol = DSolveValue[{y'[t] == 1/(2 y[t] + 3), y[0] == 1}, y, t];
Plot[sol[t], {t, -10, 10}, ImageSize -> Small]

Then I Ctrl+click the image (Macbook Pro) and save the image as test.pdf.

Then, in the same folder, I write the following latex code:

\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{test.pdf}
\end{document}

I compile using pdflatex and I get the following image.

enter image description here

Is this a bug?

$\endgroup$
3
  • $\begingroup$ Can you include what Mma version and OS you are using. There are some known problems with PDFs in V10 $\endgroup$ Jan 20 '15 at 4:57
  • $\begingroup$ Very closely related: mathematica.stackexchange.com/q/68893/131 $\endgroup$
    – Yves Klett
    Jan 20 '15 at 5:58
  • $\begingroup$ I am using Mathematica 10.0.2, macbook pro Yosemite 8.0.2, machete texlive 2014. I Ctrl+clicked the image in my notebook, selected Save Graphic As..., then selected PDF from the format list. $\endgroup$
    – David
    Jan 20 '15 at 15:25
1
$\begingroup$

This looks like a bug related to exporting via the context menu. Try exporting using:

sol = DSolveValue[{y'[t] == 1/(2 y[t] + 3), y[0] == 1}, y, t];
p = Plot[sol[t], {t, -10, 10}, ImageSize -> Small]
Export[NotebookDirectory[] <> "test.pdf", p, "PDF"]
$\endgroup$
3
  • $\begingroup$ I would recommend Export[NotebookDirectory[]<>"test.pdf",p, "PDF"]. $\endgroup$ Jan 20 '15 at 3:54
  • $\begingroup$ Yes you are right. Relying on Mathematica to infer the export format might not be a great idea. $\endgroup$
    – MBryn
    Jan 20 '15 at 3:58
  • $\begingroup$ This worked for me, so I do think we have discovered a bug. $\endgroup$
    – David
    Jan 20 '15 at 15:36
0
$\begingroup$

In generally, I used the method as below:

Plot[Sin[x], {x, -\[Pi], \[Pi]}]

Select the output cell -> Save selected as -> sample.pdf

enter image description here

\documentclass[b5paper,UTF8]{article}
\usepackage{graphicx}                               
\begin{document}
\texttt{Plot[Sin[x], {x, -Pi, Pi}]}

 \vspace{1mm}
 \fbox{\includegraphics[width=.9\textwidth]{sample.pdf}}
 \vspace{1mm}
\end{document}

enter image description here

$\endgroup$

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.