On 02/12/2023 2:07 p.m., Ben Bolker wrote:
     Sorry, jumped into the thread too late. (On the other hand, once the
document gets complicated enough, it may be worth it in the long run to
convert to something that actually has a document-generating back-end,
rather than reinventing everything from scratch ...)


I agree with that comment. However, if one is stuck with a multipage PDF file, and wants to add page numbering, you could use the LaTeX pdfpages package.

For example, this R Markdown document includes all 10 plots from Rplots.pdf on pages with "x of y" page numbering.

  ---
  title: "Numbered"
  output:
    pdf_document:
      extra_dependencies: ["pdfpages", "fancyhdr", "lastpage"]
  ---

  \cfoot{Page \thepage\ of \pageref{LastPage}}

  \addtocounter{page}{-1}

  \includepdf[pages={1-10},pagecommand={\thispagestyle{fancy}}]{Rplots.pdf}


It would make more sense to do this in a LaTeX document, but I'm not sure if Dennis knows LaTeX...

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to