平均能量损失
\documentclass{article}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{something centered in footer}
\lhead{\rule{\textwidth}{3pt}}
\pagestyle{fancy}
\begin{document}
A normal page.
\clearpage
\newgeometry{margin=.5in,includeheadfoot,hcentering}
\lipsum[1-2]
\noindent\rule{\textwidth}{3pt}
\end{document}
问题
如 MWE 所示,几何形状改变后,页脚未在第二页居中。有办法纠正这个问题吗?
答案1
这将迫使它到中心:
\cfoot{\makebox[\textwidth][c]{something centered in footer}}
代码:
\documentclass[oneside]{article}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{\makebox[\textwidth][c]{something centered in footer}}
\lhead{\rule{\textwidth}{3pt}}
\pagestyle{fancy}
\begin{document}
A normal page.
\clearpage
\newgeometry{margin=.5in,includeheadfoot,hcentering}
\lipsum[1-2]
\noindent\rule{\textwidth}{3pt}
\end{document}