Conversion Toolsps2pdf page numbering problem

Information and discussion about output converters related to LaTeX (e.g. dvips, ps2pdf, ...)
Post Reply
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

ps2pdf page numbering problem

Post by shadgrind »

Has anyone here ever seen a problem where ps2pdf will create a PDF where the page numbers in the document itself are fine, but in any PDF reader the page numbers are all roman numerals in the page navigation menu? I've attached a pic of what I mean. This is in Acrobat Reader, but the same happens in Evince. Notice the roman numeral lxix instead of 69 in the textfield:
pageroman.png
pageroman.png (6.87 KiB) Viewed 9625 times
I normally use dvips and ps2pdf to convert my LaTeX files to PDF, and this has worked fine for me in Fedora 7. But when I upgraded to Fedora 11 this problem suddenly appeared. And the weird thing is it only happens some of the time. The postscript files created by dvips show the page numbers correctly in any postscript viewer, so I think ps2pdf (part of ghostscript) is the culprit. F7 uses ghostscript 8.15 and F11 uses ghostscript 8.70.

Recommended reading 2024:

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

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

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

ps2pdf page numbering problem

Post by localghost »

It could be helpful to have a minimal working example (MWE) at hand that reproduces this behaviour. You can generate longer parts of text (and even whole documents) by means of the blindtext package.


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

ps2pdf page numbering problem

Post by shadgrind »

OK, here's a minimal working example:

Code: Select all

\documentclass[letterpaper,11pt,titlepage,openany,twoside]{scrbook}
\usepackage[english]{babel}
\usepackage{fancybox}
\usepackage[T1]{fontenc}
\usepackage{newcent}
\usepackage{textcomp}
\usepackage[dvips,bookmarks]{hyperref}
\usepackage[toc,math]{blindtext}
\setlength\oddsidemargin{20pt}
\setlength\evensidemargin{20pt}
\setlength\topmargin{0pt}
\makeatletter
\makeatother
\begin{document}
\frontmatter
\pagestyle{empty}
\thisfancypage{\setlength{\fboxsep}{1pt}\setlength\fboxrule{1.5pt}\fbox}{}
\title{Something}
\author{\textsf{\textbf{Shad Grind}}}
\uppertitleback{Some stuff.}
\lowertitleback{No copyright.}
\maketitle
\mainmatter
\Blinddocument
\end{document}
Here's the weird part: it works fine the first time I run latex -> dvips -> ps2pdf. But if I comment out lines 3 and 17 (\usepackage{fancybox} and \thisfancypage...) and run it again, the problem appears! So my guess is that there is some kind of weird caching issue going on. I know that some temporary files get created by latex, but how would that affect the PDF created by ps2pdf?

This problem happens no matter what I do on a book I wrote. It has lots of files and graphics, and requires multiple runs to get all the references right. So I'm not sure how I'd handle any kind of cache issues with that. Any help would be appreciated.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: ps2pdf page numbering problem

Post by Stefan Kottwitz »

I've tested this example, using dvips and ps2pdf and the Acrobat Reader. The first two pages were numbered i, ii and it was numbered 1, 2, ... afterwards.
Do you get all numbers in roman?

Stefan
LaTeX.org admin
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Re: ps2pdf page numbering problem

Post by shadgrind »

Yes, I get all numbers in Roman in the page navigation toolbar in Acrobat Reader (and Evince). The numbers on the pages themselves are correct. Did you try commenting out those lines I mentioned? Also, which version of ghostscript are you using? This problem only happens for me with the ps2pdf from ghostscript 8.70; it works properly with version 8.15.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: ps2pdf page numbering problem

Post by php1ic »

I am also using ghostscript 8.70 on Fedora 11 and get the same behaviour with and without the commented lines, once I run latex a few times to get the internal references correct i.e.

without commented lines i,ii,iii
with commented lines i,ii,1,2

I'm afraid I don't have any solutions. I am just posting to show that the behaviour can be replicated, in case you were starting to think it was your computer/version of latex.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

ps2pdf page numbering problem

Post by shadgrind »

OK, I submitted a bug report to the ghostscript developers, and found out something very interesting. It turns out that the postscript file being created by dvips contains a request to label the page numbers with roman numerals. See the last comment here, and the last attachment. Making the change to the line in the postscript file indicated in the diff file does indeed change the page labels in Acrobat Reader after running ps2pdf.

So this is a problem with dvips. Basically, it was ignored in earlier versions of ghostscript, but with version 8.70 it is no longer ignored. So the question is, why is dvips generating roman numeral page labels after the table of contents? This is the dvips that comes with TexLive 2007.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Re: ps2pdf page numbering problem

Post by shadgrind »

This problem with dvips has been fixed in Tex Live 2009, I now get the proper page labels.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Post Reply