我在R-Markdown生成的PDF中使用fancyhdr包设置了页脚和页眉。但是,有时我注意到我的页脚在第一页之后消失了,而我的页眉却按预期出现在每页中。我不知道为什么会这样,我尝试了很多东西,但到目前为止似乎没有任何效果。
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot{}
- \fancyhead{}
- \renewcommand{\headrulewidth}{0pt}
... (some chunks of code go here)
\fancyhead[L]{\includegraphics[width=4cm]{/Users/username/Documents/SP_logo_login.png}}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage} \\ \today , \currenttime}
\fancyfoot[L]{Identification Report \\ User generating the report: {`r paste(user_code)`}}
\vspace*{1\baselineskip}
# IDENTIFICATION REPORT
(some more LaTex and code chunks follow, including bar plots and KableExtra tables)
...
无论我在某些代码之后还是在header-includes下,都花哨的脚都没关系。结果是一样的。页脚是在第一页上正确生成的,仅此而已,而页眉则出现在每页的开头。
有什么想法吗?
答案 0 :(得分:0)
您的标题比默认的ViewContainerRef
高得多,因此将内容和脚注推离了页面。 {include file='../../../themes/my_custom_theme/mb_templates/aboutus.tpl'}
中有一个明确的警告,告诉您标题的高度。确切的值将取决于图像的纵横比,对于我使用的示例图像,约为75pt
\headheight