MWE

\documentclass{article}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{something centered in footer}
\pagestyle{fancy}
\begin{document}
A normal page.

\clearpage
\lipsum[1-2]

\noindent\rule{\textwidth}{3pt}

\end{document}


Problem

As is shown in the MWE, the footer is not centered on the second page, after the geometry has been changed. Is there a way to correct this?

• I'd say it's perfectly normal. Why are you changing the page geometry after one page? If your aim is to have a different geometry for the title page, then change geometry for that and restore the normal one afterwards. – egreg Sep 13 '14 at 22:12
• @egreg: I want to fit a figure that is slightly too wide for a portray page and too long for a landscape page. The figure is already scaled and I don't want to scale it further for legibility concerns. So my solution was to decrease the left/right margins, which led to the above problem. – Herr K. Sep 13 '14 at 23:28
• \newgeometry is not the answer; you can simply insert the image in a \makebox[\textwidth]{...} possibly adding some space in the box to position the image as you wish. – egreg Sep 13 '14 at 23:33

This will force it to the center:

\cfoot{\makebox[\textwidth][c]{something centered in footer}}


Code:

\documentclass[oneside]{article}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{\makebox[\textwidth][c]{something centered in footer}}