如何修复使用 LaTex 从 R Markdown 生成的 PDF 文件中页脚的水平对齐方式?
这是我的 header.tex 文件:
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancyhf{}
\newcommand {\changefont} {%
\fontsize{6}{8}\selectfont
}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[LE, LO]{\includegraphics[height=1.5cm]{image1.png}}
\fancyfoot[CE, CO]{\changefont This is the placeholder for the middle footer text that is very lengthy and occupies at least 3 lines}
\fancyfoot[RE, RO]{\includegraphics[height=1.5cm]{image2.png}}
\fancypagestyle{plain}{\pagestyle{fancy}}
我的 RMD 文件有以下 yaml:
---
title: "PDF Outpuf File"
output:
pdf_document:
includes:
in_header: Span_Data_Explorer/header.tex
---
我如何使页脚水平对齐(底部对齐、居中对齐或顶部对齐)?
这就是我希望我的页脚看起来的样子(总体来说)。
答案1
对于居中和底部对齐,您可以将页脚项的内容放在小页面内,如下所示:
\documentclass{book}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancyhf{}
\newcommand {\changefont} {\fontsize{6}{8}\selectfont}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[LE, LO]{
\begin{minipage}[c]{1.55cm}\includegraphics[height=1.5cm]{example-image-b}\end{minipage}}
\fancyfoot[CE, CO]{\begin{minipage}[c]{.6\textwidth}\changefont This is the placeholder for the middle footer text that is very lengthy and occupies at least 3 lines is very lengthy and occupies at least 3 lines is very lengthy and occupies at least 3 lines\end{minipage}}
\fancyfoot[RE, RO]{\begin{minipage}[c]{1.55cm}\includegraphics[height=1.5cm]{example-image-b}\end{minipage}}
\fancypagestyle{plain}{\pagestyle{fancy}}
\setlength{\footskip}{3cm}
\begin{document}
\lipsum
\end{document}
输出:
底部需要一些黑客或其他方式......
PS:为了获得更好的底部效果,inner sep=0
也会有所帮助...