Page numbering off by 1

Herbert Voss Herbert.Voss at fu-berlin.de
Thu Jul 22 13:05:10 CEST 2021



Am 22.07.21 um 00:20 schrieb Jerry Seibert:
> I am trying to place a frame around several pages in a document I am creating. The frame works fine, "varioref" gets the page number wrong.

Looks like a problem with the pgf box. Here is a solution with
fabcybox:

\documentclass{report}%
\usepackage[letterpaper, left=0.50in, right=0.50in, top=0.50in, 
bottom=1.00in]{geometry}
\usepackage{fancyhdr,fancybox} % Custom page headers and footers%
\usepackage{lastpage}

\pagestyle{fancy} % set page style to fancy%
\fancyfoot{} % clear the footers%
\fancyhead{} % clear the headers%
\renewcommand{\headrulewidth}{0pt} % Eliminate the head rule line%
\renewcommand{\footrulewidth}{2.0pt}
\pagenumbering{arabic}%

\fancyfoot[r]{\footnotesize \textbf{Page \thepage\ 
of~\pageref*{LastPage}}}%%

\fancypage{%
        \setlength\fboxsep{8pt}%
        \setlength\fboxrule{2pt}%
        \fbox}{}
\begin{document}
     Start of document \pageref{page2} and \pageref{page3}.
     \cleardoublepage
     this is page 2. \label{page2}
     \cleardoublepage
     this is page three \label{page3}
\end{document}

Herbert





> <code>
>
> \documentclass[10pt,letterpaper,notitlepage]{report}%
> \usepackage[verbose=silent]{microtype} %Subliminal refinements towards typographical perfection%
> \usepackage[letterpaper, left=0.50in, right=0.50in, top=0.50in, bottom=1.00in]{geometry} %add ``showframe'' to see the margins%
> \usepackage{fontspec}
> \usepackage{luatextra}
> \defaultfontfeatures{Ligatures=TeX}
> \usepackage{fontenc} % Allows the user to select font encodings%
> \usepackage[dvipsnames,svgnames,x11names,table,hyperref,fixpdftex]{xcolor} % Driver independent access to several kinds of colors, tints, etcetera%
> \usepackage[en-US]{datetime2}%
> \usepackage[full]{textcomp} % Font families with sub-encoding%
> \usepackage[inline]{enumitem} % Control layout of itemize, enumerate, description - use enumerate* for inline lists}%
> \usepackage[parfill]{parskip} % Adjust paragraph spacing%
> \usepackage{anyfontsize} % Lets the user select any font size i.e. \fontsize {}{}\selectfont%
> \usepackage{calc} % Simple arithmatic in latex commands%
> \usepackage{fancyhdr} % Custom page headers and footers%
> \usepackage{graphicx} % Enhanced support for graphics % Driver independent color extentions for latex and pdflatex%
> \usepackage{lastpage} % If the hyperref package is used, the references are hyperlinked to their aims. If these hyperlinks shall be suppressed, \pageref*{...} instead of \pageref{...}can be used.%
> \usepackage{luacolor}
> \usepackage{pgf}
> \usepackage{pgfmorepages}
> \usepackage[nospace]{varioref} % This package defines the commands \vref, \vpageref, \vrefrange, and \vpagerefrange for LATEX2".%
> \usepackage[hidelinks]{hyperref} % Must be loaded last. It extends the functionality of all the LATEX cross-referencing commands (including the table of contents, bibliographies etc) to produce \special commands which a driver can turn into hypertext links%
>
> \pgfpagesdeclarelayout{boxed}
> {
> 	\edef\pgfpageoptionborder{0pt}
> }
> {
> 	\pgfpagesphysicalpageoptions
> 	{%
> 		logical pages=1,%
> 	}
> 	\pgfpageslogicalpageoptions{1}
> 	{
> 		border code=\pgfsetlinewidth{2pt}\pgfstroke,%
> 		border shrink=\pgfpageoptionborder,%
> 		resized width=.95\pgfphysicalwidth,%
> 		resized height=.95\pgfphysicalheight,%
> 		center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
> 	}%
> }
>
> \pgfpagesuselayout{boxed}
>
> \pagestyle{fancy} % set page style to fancy%
> \fancyfoot{} % clear the footers%
> \fancyhead{} % clear the headers%
> \renewcommand{\headrulewidth}{0pt} % Eliminate the head rule line%
> \renewcommand{\footrulewidth}{2.0pt} % Create a separator line between the document and the footer 2.0pt wide%
> \pagenumbering{arabic}%
> \fancyfoot[r]{{\footnotesize \textbf{Page \thepage\ of~\pageref*{LastPage}}}}%%
>
> \begin{document}
> 	Start of document\vref{page 3}.
> 	\cleardoublepage
> 	this is page 2. \label{page 2}
> 	\cleardoublepage
> 	this is page three \label{page 3}
> \end{document}
>
> This produces: Start of document on page 4.
>
> If I comment out "\pgfpagesuselayout{boxed}", the correct page number is shown. The last page number is correctly printed on each page either way.
>
> I cannot find a way to correct this. It is just an incompatability between "varioref" and "pgf" and "pgfmorepages"?
>



More information about the texhax mailing list.