GeneralPDF Document Properties

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

PDF Document Properties

Post by justastudent »

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.

Code: Select all

\documentclass{article}
\usepackage{graphicx} 
\begin{document}
  \begin{figure}[h]
    \centering
    \includegraphics{figure.eps}               
    \caption{Test EPS}
    \label{fig:test}
  \end{figure}
\end{document}
I tried \hypersetup, but still getting the same output.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: PDF Document Properties

Post by localghost »

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
justastudent
Posts: 3
Joined: Mon Nov 21, 2011 2:18 pm

Re: PDF Document Properties

Post by justastudent »

Well, it is possible to use pdflatex on .eps, but then psfrag won't work.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PDF Document Properties

Post by localghost »

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.
justastudent
Posts: 3
Joined: Mon Nov 21, 2011 2:18 pm

PDF Document Properties

Post by justastudent »

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.

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage{psfrag}
\begin{document}

\begin{figure}[h]
  \centering
      \psfrag{Percentage}{\scriptsize Graphs (\%) }
   \psfrag{Rho}[bl][bl]{\scriptsize $\rho$ }
\includegraphics{figure.eps}               
   \caption{Test EPS}
  \label{fig:test}
\end{figure}
\end{document}
Attachments
figure.eps
Gnuplot created eps
(18.62 KiB) Downloaded 290 times
Last edited by Stefan Kottwitz on Tue Nov 22, 2011 3:08 pm, edited 1 time in total.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

PDF Document Properties

Post by shadgrind »

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:

Code: Select all

SDict begin [
  /Title (something.tex)
  /Subject (gnuplot plot)
  /Creator (gnuplot 4.4 patchlevel 3)
  /Author (someone)
  /Producer (gnuplot)
  /Keywords ()
  /DOCINFO pdfmark
end
Comment out the /Title, /Subject, /Creator, /Author, /Producer, and /Keywords commands with a percent sign:

Code: Select all

SDict begin [
%  /Title (something.tex)
%  /Subject (gnuplot plot)
%  /Creator (gnuplot 4.4 patchlevel 3)
%  /Author (someone)
%  /Producer (gnuplot)
%  /Keywords ()
  /DOCINFO pdfmark
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
Post Reply