Quantcast
Channel: How to add common pagenumber without decreasing page size? - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

How to add common pagenumber without decreasing page size?

$
0
0

I can include pdf documents as they are in the common pdf document, but I cannot do it with common page numbering in the top right corner. The following fancyhdr does not have any effect on have page numbering on the top of pdf documents. It would be great if the page numbering would be on top of pdf documents because they are just articles where plenty of space there. Code proposed based on the thread Base document page numbers with pdfpages about base document

\documentclass{article}\usepackage{pdfpages}% https://tex.stackexchange.com/q/56316/13173\usepackage{fancyhdr}\pagestyle{fancy}\fancyhf{}\fancyhead[R]{\thepage}\renewcommand{\headrulewidth}{0pt} % Werner, remove top margin border\begin{document}\includepdf[pagecommand=\thispagestyle{plain}]{sforzo.pdf}\includepdf[pagecommand=\thispagestyle{plain}]{testData.pdf}\includepdf[pagecommand=\thispagestyle{plain}]{sforzo.pdf}\end{document}

Fig. 1 Output with pagestyle{plain} where you see that the approach decreases the size of the page, Fig. 2 Output with pagestyle{fancy} and renewcommand

enter image description hereenter image description here

The fancy pagestyle looks better, but I would still like to maintain the page size. The following Werner's proposal stays in loop and never ends, so I cannot get any output with it

\let\oldincludepdf\includepdf \renewcommand{\includepdf}[2][]{\oldincludepdf[pagecommand=\‌​thispagestyle{fancy}‌​,#1]{#2}}

Werner's correct answer

\usepackage{letltxmacro} \LetLtxMacro\oldincludepdf\includepdf \renewcommand{\includepdf}[2][]{\oldincludepdf[pagecommand={‌​\thispagestyle{fancy‌​}},#1]{#2}}

Output without decreasing the page size

enter image description here

TeXLive 2016
OS: Debian 8.5


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images