微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Fancyhdr 不显示页码

如何解决Fancyhdr 不显示页码

我正在为 fancyhdr 包苦苦挣扎。具体来说,有以下几点:

\fancypagestyle{mystyle}{
\fancyhead{}
\fancyfoot[C]{\thepage}
\setlength{\headheight}{180pt}
\chead{\includegraphics[width=8cm]{x.png}}
}

使用 \thispagestyle{mystyle} 时,页眉显示正确,但页码根本不显示。有人可以帮我吗?

解决方法

在标准的 Latex 类中,没有足够的空间容纳 180pt 高度的页眉而不会将页脚推离页面。如果降低文本区域的高度,可以看到实际打印了页码:

\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancypagestyle{mystyle}{
\fancyhead{}
\fancyfoot[C]{\thepage}
\setlength{\headheight}{180pt}
\chead{\includegraphics[width=8cm]{example-image-duck}}
}

\usepackage[includeheadfoot,height=15cm]{geometry}

\begin{document}

\thispagestyle{mystyle}

test


\end{document}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。