Tag Info

Hot answers tagged

15

The package zref-totpages can deliver the total number of pages and with expl3 we have a powerful number crunching system. \documentclass[12pt,paper=a4]{scrbook} \usepackage{scrpage2} \usepackage{blindtext} \usepackage{zref-totpages} \usepackage{xparse} \usepackage{xcolor} \ExplSyntaxOn \NewDocumentCommand{\percentage}{} { \int_compare:nTF { \ztotpages ...


12

\documentclass{scrartcl} \usepackage{xparse} \usepackage{scrlayer-scrpage} \cfoot{\percentpagemark} \AtEndDocument{\label{last-page}} \ExplSyntaxOn \NewDocumentCommand \percentpagemark { } { \int_set:NV \l_tmpa_int { \value{page} } \int_set:NV \l_tmpb_int { \pageref{last-page} } \fp_eval:n { round( 100*\l_tmpa_int/\l_tmpb_int , 2 ) } \, \% ...


8

Another approach, with page counters and usage of calculator package. The percentage is calculated via \CalculatePercentage[]{}{}, where the first optional argument contains the number of digits for round off, the 2nd argument is the designed for the current page number and the 3rd argument holds the total number of pages. I used a different approach, ...


5

\ifnum\numexpr\c@page>\numexpr\uniquenameforthisfile+5\relax \xdef\uniquenameforthisfile{\the\c@page} \input{thisfile} \fi together with initialisising \def\uniquenameforthisfile{0} at the start should not input the file twice within 5 pages (it would be a bit more accurate to use \pageref to get the page number but trickier to set up especialy if ...


4

Use specially-placed commands to switch between the page number representation: \documentclass[12pt,ngerman,openany]{report} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \selectlanguage{ngerman} \usepackage{amssymb} \begin{document} \pagenumbering{roman}% Pages will be numbered i, ii, iii, iv, v, vi, ... Something on page i \clearpage ...


4

Here is a simple solution with titlesec/titleps for the page numbers at the edge of the paper sheet: \documentclass[12pt, twoside]{book}% \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[x11names]{xcolor} \usepackage[showframe, nomarginpar]{geometry} \usepackage[pagestyles]{titlesec} ...


3

Add \nopagenumbers to the preamble. A complete example using the template you linked to (which apparently is an outdated version of the class, by the way, since it uses outdated commands): %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % "ModernCV" CV and Cover Letter % LaTeX Template % Version 1.11 (19/6/14) % % This template has been downloaded from: % ...


3

Because the question doesn't include the word LaTeX, I can show the non-LaTeX solution. The first task (percent of total page) is simple with opmac's \lastpage: \input opmac \openref \footline={\rm\thefontsize[10]\hfil\the\pageno\ / \dopercent\pageno of\lastpage\hfil} \def\dopercent #1of#2{\ifnum#2=0 ??\else \tmpdim=#1 pt \multiply\tmpdim by10 ...


2

The \topmargin length is what you're likely looking for. See Page Layout in the LaTeX Wikibook, or the following for more options: \documentclass[12pt,a4paper]{report} \usepackage{fancyhdr} \usepackage{layout} \setlength{\topmargin}{0.25in} \fancyhf{} \fancyhead[R]{\thepage} \pagestyle{fancy} \fancypagestyle{plain} \fancyhf{} % clear all header and footer ...


2

I suggest usage of the geometry package, with tmargin=1.25in option. \documentclass[12pt,a4paper]{report} \usepackage[showframe=true,tmargin=1.25in]{geometry} \usepackage{fancyhdr} \usepackage{lipsum} \fancyhf{} \fancyhead[R]{\thepage} \fancypagestyle{plain}{% \fancyhf{} % clear all header and footer fields \fancyhead[R]{\thepage} % except the center } ...


2

This solution also uses the geometry package, but takes into account the depth of descenders in the current font. If you want the baseline of page numbers to be exactly at 1.25in from the top of the papersheet, you add these lines to your preamble: \newlength{\adjustd} \settodepth{\adjustd}{gjpqy} \usepackage[top=\dimexpr 1.25in + \headsep + \adjustd ...


2

If you really want to add them to a PDF file, such as for legal documents, these tricks might work for you. Add page numbers to a doc first convert with pdf2ps and back with ps2pdf to fix xref table (Problem, this rasterizes. Somehow pass -dNoVerifyXref thru pspdftool to gs?) pspdftool 'number(start=1, size=20, x=550 pt, y=10 pt)' test-bar.pdf ...


2

For the page numbers to remain fixed, I would use two different page styles. The regular page style will be virtually duplicated for the fixedpage page style, except for \thepage: \documentclass{article} \usepackage[paper=a6paper]{geometry}% Just for this example \usepackage{fancyhdr,lipsum} \fancypagestyle{regular}{% \fancyhf{}% Clear header/footer ...


1

Unfortunately, there is no MWE in the question but I guess that you have to redefine the pagestyle plain: \documentclass{book} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{fancyhdr} \pagestyle{fancy} \fancyfoot[LE,RO]{\thepage} \cfoot{} % redefine page style plain \fancypagestyle{plain}{% \fancyhf{} % clear all header and footer fields ...


1

... \begin{document} \renewcommand\thepage{} ... ... some pages ... \setcounter{page}{1} \renewcommand\thepage{\arabic{page}} ... ... some more pages with a pagenumber


1

The visibility of the page numbers can be explained the following way: Page 1: \thispagestyle{empty} by \begin{titlepage} Page 2: \thispagestyle{plain} by \chapter* of \tableofcontents Pages 3 to 8: \pagestyle{empty} right after \begin{document} Page 9: \pagestyle{plain} right before \clearpage Page style empty means, the page number is not visible. ...


1

at the beginning of your file, issue the command \pagenumbering{roman} when you want the page numbers to restart and change to arabic, issue the commands \clearpage \pagenumbering{arabic} \pagenumbering automatically resets the counter to "1". some document classes have shortcuts for this, but you didn't say what class you're using.



Only top voted, non community-wiki answers of a minimum length are eligible