页脚的内容始终从页脚空间的顶部开始。这里我有一个多行页脚,我希望它的底部与页脚空间的底部对齐。
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{datetime}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{geometry}
\geometry{includeheadfoot,a4paper, top=1in, bottom=2in}
\renewcommand\footrulewidth{0.1pt}
\pagestyle{fancy}
\fancyfoot[C]{%
\makebox[0pt]{\begin{tabular}[b]{c}
\textbf{this is the first line in footer} \\
this is the second line in footer \\
this is the third line in footer
\end{tabular}}}
\begin{document}
\lipsum[1]
\end{document}[![enter image description here][1]][1]
最终解决方案 我的解决方案:
\fancyfoot[C]{%
\begin{minipage}[b][1.5in][b]{\textwidth}{
\centering\Longstack{
\textbf{this is the first line in footer} \\
this is the second line in footer \\
this is the third line in footer
this is the fourth line in footer%
}
\end{minipage}}
如下所示,页脚内容的底部仍然位于页脚区域的底部,但其中的行数保持不变。
更简单的解决方案我的其他解决方案:
\geometry{top=1in, bottom=1.8in, foot=0.5in}
% "foot=" is the space between the bottom of the text in the document
body and the top of the footer.
[ ... ]
\rfoot{\thapage/\pageref{LastPage}}
\cfoot{}
\lfoot{%
\parbox[t][1.0in][t]{\textwidth}{
\textbf{this is the first line in footer} \\
this is the second line in footer \\
this is the third line in footer
this is the fourth line in footer%}}
答案1
在与 OP 商讨意见后,我试图强调这一点,即无论页脚发生什么,文档文本区域的底部都是固定的。考虑到这一限制,OP 决定,除了最初想要的之外,下一个最佳选择是在文本底部和页脚之间留出一个固定的空间。
可以通过将\Longstack
我原来的答案中的改为 来实现\Longunderstack
。由 OP 决定foot=
美观的值。在这里,我选择20pt
。这意味着多行页脚将悬挂在指定页脚框的底部下方。
我再次展示了已开启的 MWE showframe
。
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{datetime}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\geometry{includeheadfoot,a4paper, top=1in, bottom=2in,foot=20pt}
\renewcommand\footrulewidth{0.1pt}
\pagestyle{fancy}
\fancyfoot[C]{%
\Longunderstack{
\textbf{this is the first line in footer} \\
this is the second line in footer \\
this is the third line in footer}}
\usepackage[usestackEOL]{stackengine}
\begin{document}
\lipsum[1-5]
\end{document}
此处,已[showframe]
删除:
原始方法
如果要堆叠行,则需要使页脚更高。在这种情况下,我会添加foot=50pt
到您的\geometry
规范中。为了查看与文本区域相关的结果,我暂时将选项添加[showframe]
到geometry
。
我还将页脚改为堆栈,我认为在这种情况下这样做更容易。
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{datetime}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[showframe]{geometry}
\geometry{includeheadfoot,a4paper, top=1in, bottom=2in,foot=50pt}
\renewcommand\footrulewidth{0.1pt}
\pagestyle{fancy}
\fancyfoot[C]{%
\Longstack{
\textbf{this is the first line in footer} \\
this is the second line in footer \\
this is the third line in footer}}
\usepackage[usestackEOL]{stackengine}
\begin{document}
\lipsum[1]
\end{document}
关闭后[showframe]
: