LaTeX forum ⇒ Page LayoutDate and timestamp in footer as well as pagenumber Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
mcsentas
Posts: 7
Joined: Thu Nov 23, 2017 5:53 pm

Date and timestamp in footer as well as pagenumber

Postby mcsentas » Thu Nov 30, 2017 4:00 pm

How do I insert the date and a timestamp in the bottom left footer of my document, and the page number on the right.?

I have the following where I am using pdfpages.

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage{fancyhdr}
  4. \usepackage{pdfpages}
  5.  
  6. \pagestyle{fancy}
  7. \fancyhf{}
  8. \fancyhead[C]{Biological Processes}
  9. \fancyfoot[C]{\thepage}
  10.  
  11. \begin{document}
  12. \Huge Biological Processes
  13. \includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}
  14.  
  15. \end{document}

Tags:

User avatar
nlct
Posts: 271
Joined: Thu Nov 06, 2008 11:15 am

Postby nlct » Mon Jan 22, 2018 12:33 am

For the page number on the right you just need to change "C" to "R":
  1. \fancyfoot[R]{\thepage}

For the date and time stamp, do you mean the time stamp of the document build? If so, you can use\DTMnow from the datetime2 package:
  1. \fancyfoot[L]{\DTMnow}

If you mean the time stamp of the included PDF, then you can use:
  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage{fancyhdr}
  4. \usepackage{pdfpages}
  5. \usepackage{datetime2}
  6.  
  7. \DTMsavefilemoddate{pdfmodtime}{slides.pdf}
  8.  
  9. \pagestyle{fancy}
  10. \fancyhf{}
  11. \fancyhead[C]{Biological Processes}
  12. \fancyfoot[R]{\thepage}
  13. \fancyfoot[L]{\DTMuse{pdfmodtime}}
  14.  
  15. \begin{document}
  16. \Huge Biological Processes
  17. \includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}
  18.  
  19. \end{document}


There are various different date and time styles available. If you want to use a regional style, you also need to install the appropriate language module. For example, with datetime2-english installed you can do:
  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage{fancyhdr}
  4. \usepackage{pdfpages}
  5. \usepackage[en-GB]{datetime2}
  6.  
  7. \DTMsavefilemoddate{pdfmodtime}{slides.pdf}
  8.  
  9. \pagestyle{fancy}
  10. \fancyhf{}
  11. \fancyhead[C]{Biological Processes}
  12. \fancyfoot[R]{\thepage}
  13. \fancyfoot[L]{\DTMuse{pdfmodtime}}
  14.  
  15. \begin{document}
  16. \Huge Biological Processes
  17. \includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}
  18.  
  19. \end{document}


Regards
Nicola Talbot


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 6 guests