3
$\begingroup$

I make my slides in LaTeX and my pictures in Mathematica. I want to keep the fonts the same throughout, so when I have an image with text in it, I convert the text to "CMU Bright" font in Mathematica before I export the image as a pdf.

If my image includes an overbar or a square root, it looks like this:

Image = Graphics[Text[Style[{OverBar[x] Sqrt[x],"Overscript[x, _],Sqrt[x]"}, FontFamily->"CMU Bright"], {1, 3}]]

enter image description here

But when I export it as a pdf there are big gaps between the x and the bar.

Export[NotebookDirectory[] <> "image.pdf", Image ]

enter image description here

Does anyone know what's causing this or how to fix it?

$\endgroup$
2
  • $\begingroup$ I can't reproduce the behavior you see in v.11. After exporting to PDF and opening in Adobe Acrobat, this is what I see, i.e. no extraneous spacing. Notice also that you have extra " in your code which I think are not intended. You also should not use Image since it's a built-in symbol. $\endgroup$
    – MarcoB
    Commented Nov 15, 2016 at 20:39
  • $\begingroup$ Don't use Image =.... Image is a builtin symbol. Export[..., Image] is also invalid. It should be Export[..., "PDF"]. $\endgroup$
    – Szabolcs
    Commented Nov 20, 2016 at 11:54

1 Answer 1

5
$\begingroup$

I have seen this very problem before. Typesetting does sometimes change when exporting to PDF, and the result may change slightly from version to version.

I recommend that you simply use LaTeX to typeset these, through the MaTeX package.

This problem was the actual reason why I wrote MaTeX. Coincidentally, I was annoyed by precisely a square root and an overbar, just like you ...

<<MaTeX`

MaTeX[OverBar[x] Sqrt[x]]

enter image description here

MaTeX["\\bar x \\sqrt{x}"]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.