Graphics, Figures & TablesProblem using .pdf in figure

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

Problem using .pdf in figure

Post by NSutcliffe »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: Problem using .pdf in figure

Post by localghost »

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¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ 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

Re: Problem using .pdf in figure

Post by NSutcliffe »

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!
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: Problem using .pdf in figure

Post by localghost »

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.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ 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

Re: Problem using .pdf in figure

Post by NSutcliffe »

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)
(2.88 KiB) Downloaded 333 times
nonaltnotrot.pdf
pdf file
(35.42 KiB) Downloaded 370 times
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: Problem using .pdf in figure

Post by localghost »

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
The PDF file opened with Adobe Reader.
The PDF file opened with Adobe Reader.
openPDF.png (30.88 KiB) Viewed 12186 times
The SVG file opened with Inkscape.
The SVG file opened with Inkscape.
openSVG.png (46.85 KiB) Viewed 12188 times
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ 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

Re: Problem using .pdf in figure

Post by NSutcliffe »

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...
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problem using .pdf in figure

Post by localghost »

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.
The PDF file viewed with SumatraPDF.
openPDF-S.png (23.18 KiB) Viewed 12167 times
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ 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

Re: Problem using .pdf in figure

Post by NSutcliffe »

Thanks localghost; the problem was Adobe reader. For whatever reason it was not correctly displaying the file, but a reinstall fixed the problem. :)

Nick
Post Reply