Questions tagged [lastpage]

{lastpage} puts the label LastPage (\AtEndDocument) into the .aux file, allowing the user to refer to the last page of a document. This might be particularly useful in places like headers or footers.

Filter by
Sorted by
Tagged with
0 votes
0 answers
59 views

\pageref refers to second to last page of document part with floats cleared by \clearpage instead of last page

I have a document where I input the main part via \input{}, add a label to refer to for the page numbering (similar to how the lastpage-package works) and use a \clearpage to start the appendix on the ...
UberLu's user avatar
  • 9
1 vote
3 answers
54 views

Packages lastpage and refcount and hyperref missing number, treated as zero. \begingroup

A question asked here How to get second last page as a number without hyperref? had an answer, which was accepted and must have worked at the time: \documentclass[a5paper]{article} \usepackage{...
James's user avatar
  • 105
4 votes
1 answer
122 views

Clash between packages: lastpage, babel and microtype

The following code causes an error when I try to compile it. \documentclass{book} \RequirePackage{lastpage} \RequirePackage[polutonikogreek]{babel} \RequirePackage[babel=true]{microtype} \begin{...
Colas's user avatar
  • 6,658
1 vote
1 answer
38 views

Correct the last page number of frontmatter

I want to show the last page number of front matter. This is the code: \documentclass{book} \usepackage{blindtext} \usepackage{lastpage} \begin{document} \frontmatter \begin{tabular}{ll} ...
Ongky Denny Wijaya's user avatar
1 vote
1 answer
73 views

moderncv: suppress links to last page

How can I suppress the links to the last page on each page? Consider the following example: \documentclass[colorlinks]{moderncv} \usepackage{lipsum} \name{}{} \begin{document} \lipsum \end{...
Thrash's user avatar
  • 633
1 vote
0 answers
28 views

How to automatically create an appropriate amount of horizontal space between a title and a page number in the table of contents when using svmono?

Feeding \documentclass[deutsch]{svmono}% taken from https://resource-cms.springernature.com/springer-cms/rest/v1/content/20566/data/monographs \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \...
user avatar
3 votes
2 answers
360 views

How to add an empty unnumbered page to the end of a document?

I would like to add an empty (double) page to the end of a document, which is not counted by commands like \pageref{LastPage}. If you want so, one could say the printer should add an empty page. \...
allo's user avatar
  • 339
0 votes
1 answer
231 views

Putting a rectangle with text inside

how can I put a rectangle on the bottom page for all pages in latex and inside of each on this content 'Confidential' please? And how can I display current page /total page ? Actually I have only the ...
Zokulko's user avatar
  • 131
0 votes
0 answers
81 views

Evaluate LastPage when compiling with pdflatex from python

Actually not sure if this belongs here or rather to stackoverflow... I have a Python script that generates a report p = Popen(['pdflatex', 'rendered.tex', '-job-name', 'out', '-output-directory', ...
po.pe's user avatar
  • 319
1 vote
0 answers
196 views

pageref gives section name and other information

tl;dr: \pageref{} gives section name and other info additional to pagenumber I want to display the page numbers in my document in a "current page / all pages" form and defined \fancyfoot[LE,...
Lilly's user avatar
  • 11
1 vote
1 answer
124 views

save a counter to the aux file and read it later

I would like to write a counter to the aux file and then read it back when compiling the tex file for the second time. Basically, I am trying to write a command that has the same logic as the LastPage ...
Marc Corluy's user avatar
0 votes
1 answer
140 views

call the last page before \includepdf

I have a proposal letter (my latex is in article though)with 6 pages. I have a header that says page # of ##. # is the page number and ## is the total number of pages. So the last page should be page ...
Hadi Moosavi's user avatar
0 votes
1 answer
165 views

Appendix prefixes in page numbers, but not in page count

I would like to have an A prefix in appendix page numbering, but not in appendix page count. A MWE inspired be this answer. \documentclass[a4paper,12pt,bibliography=totoc]{scrartcl} \usepackage{...
Samuel Saari's user avatar
2 votes
2 answers
81 views

Colored footer with \pagref fails (page x of y)

I use the package fancyhdr together with lastpage. When I change the color of the footer with \documentclass[a4paper,11pt,naustrian]{article} \usepackage[left=2.5cm, right=2.5cm, top=4.3cm, bottom=2cm,...
LeO's user avatar
  • 1,363
0 votes
1 answer
222 views

Lastpage and \enddocumenthook: extra page created

Here is a MWE that on my Mac (MacTeX, several months old) produces the expected one page of output (as also happen on earlier versions of MikTeX), but on the latest version of MikTeX (21.1) produces ...
rbrignall's user avatar
  • 1,462
1 vote
0 answers
106 views

Starting page number getting in .aux file

How to get starting pagenumber getting in .aux file? we have option to get lastpage number using "lastpage.sty" to print in .log file, we need same way to get first page number via .aux file?...
Rajesh N's user avatar
  • 829
1 vote
1 answer
149 views

How can I print “page # of ##” with the total page number in KOMA (scrartcl/scrletter)?

This questions explains how you can show the total page number of your document in the footer on each page, i.e. show a “page # of ##” instead of the default “page # of #”. However, even though ...
rugk's user avatar
  • 1,070
2 votes
2 answers
524 views

How can I print “page # of ##” with the total page number in KOMA (scrlttr2)?

This questions explains how you can show the total page number of your document in the footer on each page, i.e. show a “page # of ##” instead of the default “page # of #”. However, even though ...
rugk's user avatar
  • 1,070
0 votes
2 answers
957 views

Total number of pages of section

For all sections (or even subsections) in my document (beamer presentation), I want to show the page number only relative to the (sub)section, and also the total number of pages per (sub)section. So ...
Albert's user avatar
  • 2,697
8 votes
2 answers
2k views

After recent update of MikTeX, ! Package totpages Error: Can't use both, lastpage and totpages

\documentclass[12pt, a4paper]{article} \usepackage{amsmath} \usepackage{adjustbox} % uses graphicx \usepackage[top=1.8cm,bottom=1.8cm,left=0.88cm,right=0.88cm]{geometry} \usepackage{fancyhdr} \...
CasperYC's user avatar
  • 659
0 votes
0 answers
80 views

Lastpage conflicts with glossaries-extra [Solved - see comment Ulrike Fisher]

When I use the stylish article template class by M. Legrange (see https://www.latextemplates.com/template/stylish-article), I encounter two problems using this class together with the glossaries or ...
alchemist's user avatar
  • 1,761
1 vote
2 answers
206 views

How can I control automatically the minimum number of lines(5 lines) in last page when it ends with reference list?

How can I control automatically the minimum number of lines(5 lines) in last page when it ends with reference list? \documentclass{article} \begin{document} Hello, here is some text without a ...
Uvaraj's user avatar
  • 31
0 votes
0 answers
75 views

How can I control the minimum number of lines in last page?

How can I control the minimum number of lines(5 lines) in last page? \documentclass{article} \begin{document} Hello, here is some text without a meaning. This text should show what a printed text ...
Uvaraj's user avatar
  • 31
4 votes
0 answers
440 views

Why does `\usepackage{cleveref}` fix the conflict between (new) hyperref, amsthm, and lastpage when using tikz externalize?

This is not a duplicate of this question. Why does adding \usepackage{cleveref} solve the conflict between lastpage, hyperref, and amsthm during externalization? The known answer proposes \...
hefe's user avatar
  • 78
0 votes
0 answers
113 views

Roman numbers including lastpage

In my report i use the function \lastpage. This works fine in the mainmatter, but it takes the lastpage of the mainmatter and not the lastpage of the frontmatter and inserts it. So in my table of ...
Michael Siggaard Jørgensen's user avatar
0 votes
0 answers
102 views

LastPage Package, don't count included pdfs in appendix

I use the LastPage package and the fancyhdr package to create a footer that lookes like %Footer \fancyfoot[L]{\footnotesize{\doctype} {\docname}} \fancyfoot[C]{\footnotesize \thepage/\pageref{...
po.pe's user avatar
  • 319
3 votes
1 answer
2k views

Reference 'last page' undefined, only running latex twice shows wanted result

If I run lualatex on a .tex file I only get ?? as a result from 'lastpage' in my document. Then if I run lualatex a second time, the correct result (2) is shown in the document footer. Main ...
brinkmannf's user avatar
2 votes
2 answers
137 views

Different text on last page

I want to add one of two different texts, depending on whether it appears on the last page. I tried this: \documentclass{article} \usepackage[angle=0, opacity=1, scale=1,position={0,0}]{background} \...
AndreKR's user avatar
  • 1,015
3 votes
1 answer
2k views

LastPage to be set on specific page

I have a very specific issue with the LastPage Package. I'll try and explain the best I can. So I have an article. That uses: \rfoot {Page \thepage \hspace{1pt} of \pageref{LastPage}} To add the ...
wodawick's user avatar
1 vote
2 answers
676 views

Adding text above page number on last page

I am wondering how to add the text "[Last Page]" above the page number on the last page of my latex document? Thanks. Hannah
Hannah D'Ambrosio's user avatar
0 votes
1 answer
412 views

Refer to LastPage when its Renamed

I am trying to get my page numbering as Page X of XX and I am using the standard syntax like, \rhead{Page \thepage\ of \pageref{LastPage}} It should work fine, expect that my last page has ...
Chen Stats Yu's user avatar
5 votes
1 answer
145 views

Why does this macro break with Lastpage?

I have made a macro \@Romankern that makes roman numerals with a negative kerning between them to make them closer to each other. I named it \@Romankern to allow it to be used with \pagenumbering. ...
John Doe-Nut's user avatar
2 votes
2 answers
131 views

automatically rescaling a document to have an even number of pages

I am trying to use the ifthen package to automatically rescale some custom vertical spaces so that if the document has an odd number of pages on the first compilation, a second compilation will reduce ...
Rax Adaam's user avatar
  • 1,697
2 votes
2 answers
88 views

Ship only the last physical page (or the last two/three physical pages)

My question is related to and in continuation to Compiling only a page range or page selection I would like to output only the last page (or last two/three pages) without knowing the total number of ...
magguu's user avatar
  • 917
2 votes
1 answer
809 views

Label last page in sequence of \includepdf commands

I am in a tricky situation. I am using NewEnviron to separate a handful of major parts of my document. Each part has its own numbering scheme and several environment-specific commands and settings. ...
AureusPhoenix's user avatar
1 vote
1 answer
544 views

Awkward conflict between lastpage, hyperref, amsthm and tikz-external

The following code cannot correctly produce the external .pdf file of the tikzpicture. Removing any of \usepackage{amsthm}, \usepackage{lastpage}, \usepackage{hyperref} solves the issue: the auxiliary ...
Rackbox's user avatar
  • 917
4 votes
1 answer
279 views

How to print a page number to a repeating header of a longtable?

The table header gets generated once and only prints: Page 1 of 2 ... on each and every page. Is there any way update the page number in the longtable header to reflect the actual current page, i....
q9f's user avatar
  • 1,995
5 votes
1 answer
1k views

What are my options for inserting a back page into my document?

I'm developing a template for articles and so far I've got the title_page.tex and main_document.tex all sorted out and I'm happy with that. My problem is I also need to have a back page in the ...
user1147964's user avatar
3 votes
1 answer
188 views

lastpage for french

Does someone know, why the package lastpage doesn't work for french? \documentclass{scrbook} \usepackage[utf8x]{inputenc} \usepackage{ucs} \usepackage{french} \usepackage{helvet} \usepackage{...
user123937's user avatar
1 vote
1 answer
820 views

exclude some pages from totalpage

I use the lastpage package, and I would like to set a command as \excludethispage to put at pages I don't want to be counted in the total of page summoned by \pageref{LastPage} (for example, I would ...
math45's user avatar
  • 341
1 vote
1 answer
740 views

Modify page number on header with scrpage2 and lastpage

I am writing a curriculum vitae using Plasmati Graduate CV Latex template. I have made some modifications in order to add both a footer and a header, using the packages scrpage2 and lastpage. I am ...
GLB's user avatar
  • 87
3 votes
1 answer
944 views

KOMA-Script article, header 'Page x of y': total pages not displayed

My 3 pages long article having the following code in the preamble produces "Page x of ??" in the header, rather than "Page x of 3" (where x stands for current page number). What am I missing? \...
Rich Shepard's user avatar
1 vote
1 answer
4k views

How can I correct the \pageref{LastPage} in this file?

I use packages lastpage and answer to make multiple choice. This is my code \documentclass[12pt,a4paper]{article} \usepackage{graphicx} \usepackage{fouriernc} \usepackage{amsmath,amssymb,amsthm} \...
minhthien_2016's user avatar
1 vote
1 answer
184 views

Unstable page numbering in aaltothesis class?

I am trying to configure the aaltothesis class here (.cls file here). The .cls file is designed with the roman pagenumbering for the pages 2-4 i.e. for abstract pages but arabic numbers for pages 5-...
Léo Léopold Hertz 준영's user avatar
1 vote
2 answers
2k views

Two column text in last paragraph latex

I am looking for a way to finish my two column document in both columns. When I get the last sheet, the text is located in just one column, like this: So, I'd like that my last paragraph located in ...
Erincon's user avatar
  • 155
2 votes
2 answers
507 views

Number of pages in preamble

I have tried this to use the number of pages as an option to a package: \documentclass{article} \usepackage{lipsum} \usepackage{lastpage} \usepackage{refcount} \newcounter{mylastpage} \...
bers's user avatar
  • 5,384
2 votes
1 answer
281 views

Writing value of LastPage to external file

How can I write the final value of LastPage (\pageref{LastPage}) to an external file (knowing that it needs 2-3 compiliations of the document)? (I need it to adapt a .cls file.) [Update 2016-01-29, ...
m42's user avatar
  • 21
2 votes
0 answers
320 views

lastpage (or pageslts) and \topskip0pt

Can anyone explain why the following mwe produces TWO pages of output? \documentclass{minimal} \usepackage{lastpage} \begin{document} \topskip 0pt Hello, world. \end{document} If I replace \topskip ...
rbrignall's user avatar
  • 1,462
1 vote
0 answers
81 views

How to use \page[quadruple] while having a cover as last page in ConTeXt?

I am creating a personalised magazine in ConTeXt-LuaTeX. It has a cover (that what you can see before opening the magazine), existing of two .pdf files. It contains several chapters adaptive text, ...
SGL's user avatar
  • 61
2 votes
1 answer
751 views

Newpage should start new page numbers with lastpage also

I want to keep everything in one master file and require to start new page numbers with lastpage also after each \newpage command. MWE is below. Any help will be highly appreciated. Thanks \...
MYaseen208's user avatar
  • 8,545