Page LayoutDate and timestamp in footer as well as pagenumber

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

Date and timestamp in footer as well as pagenumber

Post by mcsentas »

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.

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{pdfpages} 

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{Biological Processes}
\fancyfoot[C]{\thepage} 

\begin{document}
\Huge Biological Processes
\includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Date and timestamp in footer as well as pagenumber

Post by nlct »

For the page number on the right you just need to change "C" to "R":

Code: Select all

\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:

Code: Select all

\fancyfoot[L]{\DTMnow}
If you mean the time stamp of the included PDF, then you can use:

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{datetime2}

\DTMsavefilemoddate{pdfmodtime}{slides.pdf}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{Biological Processes}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{\DTMuse{pdfmodtime}}

\begin{document}
\Huge Biological Processes
\includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}

\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:

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage[en-GB]{datetime2}

\DTMsavefilemoddate{pdfmodtime}{slides.pdf}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{Biological Processes}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{\DTMuse{pdfmodtime}}

\begin{document}
\Huge Biological Processes
\includepdf[pages=-,pagecommand={\pagestyle{fancy}}]{slides.pdf}

\end{document}
Regards
Nicola Talbot
Post Reply