将页眉和页脚放入角落

将页眉和页脚放入角落

如何让页眉和页脚到达页面的右上角和右下角?现在的位置看起来很奇怪。

\documentclass{article}

\usepackage{fancyhdr}
 \pagestyle{fancy} 
 \lhead{\huge top left header}
 \chead{}
 \rhead{\huge top right header}
 \lfoot{\huge left footer}
 \cfoot{\huge center footer}
 \rfoot{\huge right footer}
 \renewcommand{\headrulewidth}{0.2pt}
 \renewcommand{\footrulewidth}{0.2pt}
\usepackage[margin=1.8cm]{geometry}

\begin{document}

\huge Will the header and footer appear properly? Will they actually reach the corners of the page? Or will the text be much wider than the header and footer?

\end{document}

在此处输入图片描述

答案1

您的问题在于您加载包的顺序。

在这里,您可以设置所需的规格,然后再使用 设置页面尺寸geometry


\documentclass{article}

\usepackage[margin=1.8cm,showframe]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy} 
\lhead{\huge top left header}
\chead{}
\rhead{\huge top right header}
\lfoot{\huge left footer}
\cfoot{\huge center footer}
\rfoot{\huge right footer}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.2pt}

\begin{document}

\huge Will the header and footer appear properly? Will they actually
reach the corners of the page? Or will the text be much wider than the
header and footer?

\end{document}

在此处输入图片描述

相关内容