3

I am loading one page pdf as an image, using \includegraphics. This page has some math in it. When I compile the Latex file, and use the TeXStudio viewer, I see the math font is not correct (from the included graphics pdf file!). The pdf image file is fine, and the generated pdf file is fine also, when I look at it using external PDF reader such as adobe.

It only shows wrong inside TeXStudio.

MWE

\documentclass[12pt]{report}%   
\usepackage{graphicx} 
\pdfminorversion=6 %needed since graphics pdf is 1.6. 
\begin{document}   
\includegraphics[width=0.8\textwidth]{a}
\end{document}

This is how the pdf looks like in Texstudio viewer:

Mathematica graphics

This is how the same compiled PDF looks like inside external adobe pdf reader:

Mathematica graphics

The image pdf file included is one page PDF file. Here is a link to this file if you like to reproduce the problem: a.pdf

I compiled the above MWE both in TL 2015 on linux and on windows using MiKTex 2.9 and in both cases, there is no problem. It is only a TeXStudio viewer issue. Looks like it is not loading some fonts and I have no idea how to fix this.

specs:

TexStudio: TeXstudio 2.10.4 (hg 5633:150614dcede6) Using Qt Version 5.5.1, compiled with Qt 5.5.1 R.

Mathematica graphics

Mathematica graphics

Any idea how to make TexStudio show the same thing as what is actually in the PDF file?

This is the pdfinfo on the a.pdf (the image pdf file included)

pdfinfo a.pdf
Creator:        TeX
Producer:       pdfTeX-1.40.16
CreationDate:   Sat Dec 19 00:17:35 2015
ModDate:        Sat Dec 19 00:17:35 2015
Tagged:         no
Form:           none
Pages:          1
Encrypted:      no
Page size:      365 x 622 pts
Page rot:       0
File size:      19737 bytes
Optimized:      no
PDF version:    1.6

Thanks to hint by cfr below, here it output from pdffonts applied on the image pdf file included.

pdffonts a.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Times-Roman                          Type 1            Custom           no  no  no      19  0
Times-Italic                         Type 1            Custom           no  no  no      20  0
Symbol                               Type 1            Symbol           no  no  no      21  0
Times-Bold                           Type 1            Standard         no  no  no      22  0
ADWCRP+rsfs10                        Type 1C           WinAnsi          yes yes no      23  0
EGYAWT+CMR10                         Type 1C           WinAnsi          yes yes no      24  0
Helvetica-Bold                       Type 1            Custom           no  no  no      25  0
GNWMUE+CMSY10                        Type 1C           Custom           yes yes yes     26  0
IQWWFY+CMMI10                        Type 1C           Custom           yes yes yes     27  0

And here is pdffonts for the main pdf file which included the above pdf file as includegraphics

>pdffonts foo.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
ZJXPIR+CMR12                         Type 1            Builtin          yes yes no       5  0
Times-Roman                          Type 1            Custom           no  no  no      21  0
Times-Italic                         Type 1            Custom           no  no  no      22  0
Symbol                               Type 1            Symbol           no  no  no      23  0
Times-Bold                           Type 1            Standard         no  no  no      24  0
ADWCRP+rsfs10                        Type 1C           WinAnsi          yes yes no      25  0
EGYAWT+CMR10                         Type 1C           WinAnsi          yes yes no      26  0
Helvetica-Bold                       Type 1            Custom           no  no  no      27  0
GNWMUE+CMSY10                        Type 1C           Custom           yes yes yes     28  0
IQWWFY+CMMI10                        Type 1C           Custom           yes yes yes     29  0

Related question may be texstudio-internal-embedded-pdf-viewer-shows-different-figure-than-external-pd

  • @cfr, thanks for the info. But how does one find if the pdf file (in this example, it will be the a.pdf file, the file I am including as image) has non-embedded fonts in it? The page I am including came from a pdf file send to use from the instructor. I am just including one page from that file, after I cropped it using pdfcrop. This is nightmare if one has to also make sure fonts are supposed to be inside pdf file or not. I assumed this is all taken care of when the pdf files are created. – Nasser Dec 24 '15 at 4:27
  • Okular shows that 4 of 9 fonts are embedded. Of those which are not, every one is being substituted on my machine by my systemwide font configuration: Helvetica and three Times fonts are being substituted by free clones and Symbol by Symbola_hint, which is presumably also a free clone. – cfr Dec 24 '15 at 4:39
  • pdffonts. pdfinfo does something different. – cfr Dec 24 '15 at 4:39
  • I've converted most of my comments to an answer to pacify the system. (But it is still complaining to me.) – cfr Dec 24 '15 at 4:57
4

The PDF has a bunch of non-embedded fonts. This means that it will appear differently in different viewers and on different systems, depending on the fonts available. acroread has its own complement of default and fallback fonts and it is probably using those. The problem in TeXStudio is most likely to be due to your system-wide font configuration i.e. which fonts you have installed and how they are configured. In particular, if you do not have the fonts the PDF requires, the system will try to substitute others. (At least, that's what happens on Linux.) Success will thus vary.

Note that even if you fix this issue in TeXStudio, the problem will persist. You should not, therefore, send a PDF with this problem to anybody else with the expectation that it will look the same or, even, display all characters in a meaningful way. As you've seen, that can in no way be guaranteed! The only good solution is to fix the PDF so that all fonts are embedded. Failing that, you could embed the file as an image. That has obvious disadvantages but should guarantee correct display on alien systems and in alien viewers.

Fonts should all be embedded when the PDF is created. Sometimes this isn't done to keep file sizes small, but mostly it is due to a combination of user ignorance. forgetfulness and poor defaults in applications which create the files.

To check that fonts are embedded, view the 'Properties' of the file in your PDF viewer (location depends on the viewer - certainly Okular, acroread etc. provide this) or use pdffonts at the command line. In the list of fonts, you should see that all fonts are Embedded (subsets are fine).

If instead you see a font used with a file system location, then it is using a font on your machine because the original font was not embedded.

In this particular file, some fonts are embedded, but others are not. So the viewer or OS has to substitute for the non-embedded ones.

Here's the output of pdffonts for the file in question:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Times-Roman                          Type 1            Custom           no  no  no      19  0
Times-Italic                         Type 1            Custom           no  no  no      20  0
Symbol                               Type 1            Symbol           no  no  no      21  0
Times-Bold                           Type 1            Standard         no  no  no      22  0
ADWCRP+rsfs10                        Type 1C           WinAnsi          yes yes no      23  0
EGYAWT+CMR10                         Type 1C           WinAnsi          yes yes no      24  0
Helvetica-Bold                       Type 1            Custom           no  no  no      25  0
GNWMUE+CMSY10                        Type 1C           Custom           yes yes yes     26  0
IQWWFY+CMMI10                        Type 1C           Custom           yes yes yes     27  0

The crucial column is emb which shows that only 4 of the 9 fonts are embedded. This means that the viewer (acroread) or the OS (for applications like TeXStudio, Okular etc.) has to substitute for the remaining 5. How successful such substitution is will vary on the configuration and availability. However, the results will not look just the way they do on the machine which created the file unless the host machine has just the same fonts, suitable settings, the same versions etc. and that is quite unlikely. Mostly, you will get something reasonable. Sometimes, as you've seen, you get something in which some characters are completely wrong.

The only way to guarantee the appearance on another machine (or the same machine after some time and updates etc. or in another viewer) is to ensure all fonts are embedded.

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.