LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Problem using .pdf in figure

Information and discussion about graphics, figures & tables in LaTeX documents.
NSutcliffe
Posts: 9
Joined: Wed Dec 17, 2008 3:16 am

Problem using .pdf in figure

Hi all,

I've been drawing diagrams using a vector graphics program and converting svg to jpeg to include them in my latex file. However, this produces a significant loss in quality, and thus I want to save the graphics as a pdf and then include them in latex. I've had no problem doing this, however, after compiling, latex has changed the graphic slightly; namely all of the colours are darker and more drab, and two polygon gradient fills have just disappeared (the other polygons I've used a gradient fill on keep their fill).

I checked the pdf file that the graphic is in, and it looks fine, so I'm not really sure what's going on here! Any help would be greatly appreciated.

Thanks,

Nick

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
You should either export your drawn graphics directly as PDF or convert from SVG (vector) to PDF (vector). Drawing with LaTeX packages could be an interesting alternative.

Best regards
Thorsten¹
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

NSutcliffe
Posts: 9
Joined: Wed Dec 17, 2008 3:16 am
I am not sure I understand your response; I am saving the graphics directly as pdf and then am proceeding to include them in the latex file. Saving the graphics as pdf is fine and all the vector graphic stuff is great, but then sending it through the pdflatex compiler, something goes wrong and the output does not look like the input pdf file!

Drawing with LaTeX packages is not an option at this point, by the sheer number of diagrams that need to be done over the next few weeks!

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
It could be helpful when you say which graphics program you use to draw your figures. That could make the problem more comprehensible. If necessary, attach the picture as SVG and PDF to your next post.
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

NSutcliffe
Posts: 9
Joined: Wed Dec 17, 2008 3:16 am
Sure localghost,

I am using Inkscape to draw the vector graphics. .svg files are not allowed as attachments so I have zipped the .svg file.

As a point of interest, the gradient shading on P3, P4, P3' and P4' disappears with the following in my latex file:

\begin{figure}[h]
\centering
\includegraphics[width=10cm]{nonaltnotrot.pdf}
\caption{An edge $e$ in $B$ glues to $P_3$, but it's neighbouring edges in $B'$ do not glue to $P'_3$}
\end{figure}
Attachments
nonaltnotrot.rar
svg file (zipped)
nonaltnotrot.pdf
pdf file

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
I can only show what I get when I open the files with the according programs. Take a look at the attachments and compare to your results. Compiling a small sample document with the included PDF file results in the same output as seen below.

When I open the SVG file with GIMP, I get an according look with your drawing elements on a transparent layer.
Attachments
openPDF.png (30.88 KiB) Viewed 7287 times
The SVG file opened with Inkscape.
openSVG.png (46.85 KiB) Viewed 7289 times
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

NSutcliffe
Posts: 9
Joined: Wed Dec 17, 2008 3:16 am
Indeed, that is what they are supposed to look like! So what is going wrong with my compiler? I am running the latest version of miktek...

localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm
Sometimes it's an issue of the viewer. I had a look at the PDF file with SumatraPDF. As you can see in the attachment, the blue areas are not fading but they end in gradient style with black. I will view this next time on my Linux system to compare the appearance.

Try to reduce the problem to a minimal working example (MWE) that reproduces the undesired effect you described in your initial post. Attach the source file, the final PDF output and a screenshot of the MWE as seen with your viewer.
Attachments
The PDF file viewed with SumatraPDF.
openPDF-S.png (23.18 KiB) Viewed 7268 times
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

NSutcliffe
Posts: 9
Joined: Wed Dec 17, 2008 3:16 am
Thanks localghost; the problem was Adobe reader. For whatever reason it was not correctly displaying the file, but a reinstall fixed the problem.

Nick