我在特定文档中进行了以下设置:
\usepackage{fancyhdr}
% -- Header and footer --------------------------------------
\pagestyle{fancy}
\fancyhf{}
\setlength{\footskip}{32pt}
\rfoot{\includegraphics[height=12mm]{figures/Gradient1}}
\lfoot{\includegraphics[height=12mm]{figures/Gradient2}}
\cfoot{
\tiny{Some really long piece of text that needs to \\
be positioned at the centre of the footer}
\\
\normalsize{\thepage}}
产生以下页脚:
左、右页脚未与中心页脚垂直对齐。图像几乎与文本对齐,跳过了正文和页脚之间的空间。相反,我期望的是这样的:
有办法吗?
答案1
使用\parbox
底部对齐方式来对齐中心脚。由于图像的底部位于基线上,因此您可以自动获得所需的效果。
\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum}
% -- Header and footer --------------------------------------
\setlength{\footskip}{48pt} % fancyhdr suggests at least 37.74333pt
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[L]{\includegraphics[height=12mm]{example-image-1x1}}
\fancyfoot[R]{\includegraphics[height=12mm]{example-image-1x1}}
\fancyfoot[C]{%
\parbox[b]{\textwidth}{%
\centering
{\tiny Some really long piece of text that needs to \\
be positioned at the centre of the footer\\}
\thepage
}%
}
\begin{document}
\lipsum[1-10]
\end{document}
答案2
\documentclass{article}
\usepackage{fancyhdr,lipsum}
\usepackage[export]{adjustbox}
\usepackage{makecell}
\pagestyle{fancy}
\fancyhf{} % Clear header/footer
\fancyfoot[L]{\includegraphics[scale=0.22,valign=c]{example-image}}
\fancyfoot[C]{\begin{tabular}
{@{}c@{}}
\tiny {\makecell[c]{Some really long piece of text that\\ needs to
be positioned at the centre of the footer}}\\ \normalsize{\thepage}
\end{tabular}}
\fancyfoot[R]{\includegraphics[scale=0.22,valign=c]{example-image}}
%\setlength{\footskip}{60pt}% Depends on image size
\begin{document}
\lipsum[1-5]
\end{document}
答案3
我设法通过在数字前插入垂直空格来获得所需的效果。 问题是这是一个负空间:
\rfoot{\vspace{-3mm}\includegraphics[height=12mm]{figures/Gradient1}}
\lfoot{\vspace{-3mm}\includegraphics[height=12mm]{figures/Gradient2}}