LaTeX forum ⇒ GeneralPDF Document Properties

LaTeX specific issues not fitting into one of the other forums of this category.
justastudent
Posts: 3
Joined: Mon Nov 21, 2011 2:18 pm

PDF Document Properties

Postby justastudent » Mon Nov 21, 2011 4:44 pm

Hello,

Including a figure in EPS format generated by Gnuplot and creating a PDF using LaTeX -> DVI -> PS -> PDF, the document properties (title, subject, creator etc.) of the generated PDF are taken from the last EPS figure included.

If I try another figure in EPS format not created by Gnuplot (Adobe or so), the document properties are correct.
  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \begin{document}
  4. \begin{figure}[h]
  5. \centering
  6. \includegraphics{figure.eps}
  7. \caption{Test EPS}
  8. \label{fig:test}
  9. \end{figure}
  10. \end{document}

I tried \hypersetup, but still getting the same output.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Mon Nov 21, 2011 8:31 pm

With current versions of the common TeX distributions it should be possible to compile with PDFLaTeX while including EPS figures. At least with TeX Live 2011 it works. EPS figures are converted to PDF on the fly.


Best regards and welcome to the board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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

justastudent
Posts: 3
Joined: Mon Nov 21, 2011 2:18 pm

Postby justastudent » Tue Nov 22, 2011 11:31 am

Well, it is possible to use pdflatex on .eps, but then psfrag won't work.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Tue Nov 22, 2011 11:54 am

justastudent wrote:Well, it is possible to use pdflatex on .eps, but then psfrag won't work.

That is something you should have mentioned right at the beginning. Then I wouldn't have proposed this approach.

There is a much smarter way to get nice plots by the pgfplots package. It uses Gnuplot as back-end. Perhaps you can upload a data set and a sample plot to the forum server so that we can see how your plots should look like. We then would be able to reproduce it with the package and do other additions for which you used psfrag.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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

justastudent
Posts: 3
Joined: Mon Nov 21, 2011 2:18 pm

Postby justastudent » Tue Nov 22, 2011 1:51 pm

Next time, I would do it that way as you suggested or use other ways like create a tex file with gnuplot. But the fundamental question remains, why the ps2pdf conversion creates a pdf with the document properties changed (i.e. inherit the properties of the last gnuplot-created .eps image in the file) instead of taking the properties of the original .ps file?

Could you check the properties of the pdf created using the following code and eps file attached ? In document properties, you get Title: comp.eps (original name of the eps before renamed to figure.eps), Subject: gnuplot plot etc. instead of the expected Title: filename.pdf etc.

  1. \documentclass{article}
  2. \usepackage{graphicx}
  3. \usepackage{psfrag}
  4. \begin{document}
  5.  
  6. \begin{figure}[h]
  7. \centering
  8. \psfrag{Percentage}{\scriptsize Graphs (\%) }
  9. \psfrag{Rho}[bl][bl]{\scriptsize $\rho$ }
  10. \includegraphics{figure.eps}
  11. \caption{Test EPS}
  12. \label{fig:test}
  13. \end{figure}
  14. \end{document}
Attachments
figure.eps
Gnuplot created eps
(18.62 KiB) Downloaded 89 times
Last edited by Stefan Kottwitz on Tue Nov 22, 2011 3:08 pm, edited 1 time in total.
Reason: code marked

User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Postby shadgrind » Tue Nov 22, 2011 3:52 pm

This is a known problem with dvips' interpretation of the pdfmark set by Gnuplot, i.e. it's a bug on the LaTeX side. The only way I've been able to overcome it is to edit the EPS file directly in a text editor before including it in a LaTeX document. Specifically, look in the EPS file for a section that looks like this:
  1. SDict begin [
  2. /Title (something.tex)
  3. /Subject (gnuplot plot)
  4. /Creator (gnuplot 4.4 patchlevel 3)
  5. /Author (someone)
  6. /Producer (gnuplot)
  7. /Keywords ()
  8. /DOCINFO pdfmark
  9. end

Comment out the /Title, /Subject, /Creator, /Author, /Producer, and /Keywords commands with a percent sign:
  1. SDict begin [
  2. % /Title (something.tex)
  3. % /Subject (gnuplot plot)
  4. % /Creator (gnuplot 4.4 patchlevel 3)
  5. % /Author (someone)
  6. % /Producer (gnuplot)
  7. % /Keywords ()
  8. /DOCINFO pdfmark
  9. end

If you then run LaTeX -> dvips -> ps2pdf the PDF should have the correct meta data. It's a little inconvenient to remember to do this all the time for Gnuplot-generated files, but I'm used to it by now. :)
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2


Return to “General”

Who is online

Users browsing this forum: No registered users and 10 guests