The .currentpage and .totalpages functions display, respectively, the current index (beginning from 1) of the page or slide where the function call appears and the total number of pages or slides. They do not accept any arguments.
These functions are supported in paged and slides documents. In other document types, the - placeholder is shown instead.
These functions return visual elements (nodes), not numbers. Therefore, you cannot perform operations like
.sum {.currentpage} {3}.
You can display a page counter on each page using page margin content:
.pagemargin {bottomcenter}
.currentpage / .totalpagesThe .formatpagenumber {format} docs ↗ function sets a new page number format from the page where it appears. It only affects page numbers from that point onwards.
The format string accepts the same syntax as the one in numbering:
1 (default) for decimal (1, 2, 3, …)a for lowercase latin alphabet (a, b, c, …)A for uppercase latin alphabet (A, B, C, …)i for lowercase roman numerals (i, ii, iii, …)I for uppercase roman numerals (I, II, III, …)These changes are reflected in .currentpage and page numbers in the table of contents.
.pagemargin {topcenter}
.currentpage
# First page
.formatpagenumber {i}
# Second page
# Third page
The .resetpagenumber {from?} docs ↗ function allows you to overwrite the current page number at any point in a paged or slides document.
These changes are reflected in .currentpage and page numbers in the table of contents.
.pagemargin {topcenter}
.currentpage
# First page
# Second page
.resetpagenumber start:{20}
# Third page