Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is a tricky question.

Say I generate an image in gnuplot using the pslatex terminal:

gnuplot<plot.plt
latex dummy.tex
dvips -E -oimage.eps dummy

where 'plot.plt' contains:

set term pslatex
set output "graph.tex"
plot "..."

and where 'dummy.tex' reads:

\documentclass{article}
\pagestyle{empty}
\begin{document}
\input graph.tex
\end{document}

I then include this 'image.eps' file in a 'main.tex' document and compile it:

latex main
dvips main -o
ps2pdf main.ps

This generates a 'main.pdf' file.

I find it quite strange but I have noticed that when I open 'main.pdf', the document title which will appear in the menu bar of the document viewer I use (evince) will be 'graph.tex' rather than 'main.pdf'.

If I modify the .eps file with a text editor (say, vim), and replace the text 'graph.tex' by something else in the .eps file, then compile the latex file, this will change what appears in the menu bar when I open my 'main.pdf' file.

Here, I would like to know if there is also a way to change the document title which appears in this menu bar using latex, when I do not have figures. Supposedly there should be I believe. How can I do that?

Thank you in advance for your help.

share|improve this question
    
Since this behaviour has nothing to do with evince I did an edit of your question and removed the according tag. –  Speravir Mar 23 '12 at 18:28
    
I understand it should have nothing to do with evince; however, in another document viewer I use (Acrobat Reader) the title is "main.pdf", at least with the current version I have. This is why I explicitly mentioned evince. –  Alex Mar 26 '12 at 13:50

2 Answers 2

up vote 9 down vote accepted

I don't see how this is related to gnuplot, but using

\usepackage{hyperref}

\hypersetup{pdftitle=foo,pdfdisplaydoctitle}

in your LaTeX document preamble might do what you want.

share|improve this answer
    
First of all: Thanks a lot, this indeed does the trick for files without images (quite tricky to explain but easily answered :)). For completeness, I have also checked what you have suggested for .tex files with images; however things remain as I have described here above in that case. I must say I do not really understand where this comes from, as everything comes in the form of .ps or .eps files: it's like this is hidden until I use ps2pdf. –  Alex Mar 23 '12 at 16:42
1  
@Stephan --- Gnuplot puts instructions in the postscript that influence the pdf metadata. –  Ian Thompson Mar 23 '12 at 17:39

This is caused by the following lines which gnuplot puts in graph.tex:

SDict begin [
  /Title (graph.tex)
  /Subject (gnuplot plot)
  /Creator (gnuplot 4.4 patchlevel 4)
  /Author (mait)
%  /Producer (gnuplot)
%  /Keywords ()
  /CreationDate (Fri Mar 23 16:20:26 2012)
  /DOCINFO pdfmark
end

I can't find anything in the gnuplot manual that prevents this behaviour, so I suggest editing the file and putting percentage symbols before /Title, /Subject, /Creator and /Author. Otherwise your figures are likely to interfere with other methods of inserting metadata into the pdf. Doing this manually is likely to be cumbersome if you have a lot of files, though.

EDIT

Gnuplot can issue system commands, so you can use a utility such as sed to automatically change the file graph.tex.

set term pslatex
set output "temp.tex"
plot x**2
set output #Closes the temporary output file.
!sed -e 's|/Title|%/Title|' -e 's|/Subject|%/Subject|' -e 's|/Creator|%/Creator|' -e 's|/Author|%/Author|' < temp.tex > graph.tex

I think this will work on any unix machine.

share|improve this answer
    
Yes, these are the lines I have been editing using vim. Note that I have noticed that only the last figure included in the document will be taken into account and needs to be edited this way. I am surprised that this is included in the .ps/.eps files, but only plays a role at the .pdf level. –  Alex Mar 23 '12 at 16:56
1  
All manner of wizardry can be performed using specials to insert instructions into the postscript code. I have edited my answer and added a means of automatically removing the offending lines. –  Ian Thompson Mar 23 '12 at 17:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.