I can use \pageref{LastPage} to give the reference of last page with lastpage package. The last page of document is the back cover so I don't want to count it. I wonder how to specify the second last page with lastpage package. Thanks in advance for your help.


Use refcount to manipulate (page) reference:

enter image description here


Last page: \pageref{LastPage} \par
Second to last page: \pageref{preLastPage}



The reason for comparing \value{page} with <LastPage>-2 is because of the fact that page numbers are stepped after printing the value - different from other counters in a document. So, \AtBeginShipout, the page counter has already been stepped and we need to insert a \label at the end of page <LastPage>-2 in order for it to be set at the start of page <LastPage>-1.

  • (+1) Thanks @Werner for your nice answer. It works like a charm except the hyperlink is broken. Any thoughts. – MYaseen208 Aug 7 '14 at 19:47
  • @MYaseen208 There can be no link if there is no anchor. – egreg Aug 7 '14 at 20:10
  • @MYaseen208: I've updated my answer. For future reference, please include a minimal example that shows you're hyperref. – Werner Aug 8 '14 at 2:16

The pageslts package puts a last page label for each numbering scheme, provided you use a pagenumbering{…} at the beginning of the document, and at every scheme change. So, for your cover page, you can use any scheme not used beforehand, setting \pagestyle{empty} immediately after:

\usepackage[ plainpages=false, pdfpagelabels=true]{hyperref}


Last page: \pageref{pagesLTS.arabic} \par
Very last page:  \lastpageref{LastPages}

section{New page numbering}


enter image description here Note that the options to hyperrefare set to prevent any problems if two pages have the same number (even in different numbering schemes), according to the documentation (§ 3.1), but aren't really necessary for the example given here. See the details of constraints in the doc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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