这个答案正确放置标题。但是,第一的页脚在不知不觉中向下移动了很多。
那么,为什么会\AtBeginDocument{\settototalheight\headerTotalHeight{\headerContents}\geometry{headheight = \headerTotalHeight}}
影响第一个页脚?
首页页脚
以下页面的页脚
\documentclass{exam}
\usepackage[export]{adjustbox}
\usepackage{graphicx}
\usepackage{calc}
\newcommand\headerContents{
\includegraphics[scale=0.2]{example-image}
}
\newlength{\headerTotalHeight}
\AtBeginDocument{\settototalheight\headerTotalHeight{\headerContents}\geometry{headheight = \headerTotalHeight}}
\pagestyle{headandfoot}
\firstpageheader{}{\headerContents}{}
\runningheader{}{\headerContents}{}
\firstpagefooter{}{first footer}{}
\runningfooter{}{running footer}{}
\usepackage[
a4paper,
includehead,
top = 0mm,
includefoot,
foot = 0 em,
bottom = 4 em,
showframe
]{geometry}
\begin{document}
text
\newpage
text
\end{document}