我有一个文档,它产生如下输出:
绿色部分可以改变其大小,具体取决于列表中的项目数。
我希望“发货至:”和“附加信息”部分始终位于页面底部,无论绿色部分有多大。
我假设我需要使用页脚来做到这一点?我一直在阅读有关页脚的文章,但我不知道如何让页脚成为这样的迷你页面:
\begin{minipage}[t]{.3\textwidth}
{\bf SHIP TO:}\\
\textit{[email protected]}
\end{minipage}
\hfill
\begin{minipage}[t]{0.4\textwidth}
{\bf ADDITIONAL INFORMATION:}\\
\textit{We accept payment by cash or cheque. Payment Is due upon receipt, and must be paid in full within {\bf 30 days}.}
\end{minipage}
整个 TEX 文件:
\documentclass[letterpaper,currency=pound]{dapper-purchase_order}
\defaultfontfeatures{ Path = ./Fonts/ }
%\usepackage{fontawesome}
\definecolor{Mblue}{RGB}{231,255,229}
%
%%%%%%%%%%%%%%%%%% HEADING SECTION %%%%%%%%%%%%%%%%%%
\newcommand{\purchaseOrderNo}{31401} % Invoice Number
\newcommand{\Date}{01/01/2018} % Date
\newcommand{\clientName}{CUSTOMER NAME LTD} % Client Name
%----------------------------------------------------
%
\begin{document}
\newfontface\mainLightItalic{OpenSans-LightItalic}
\makeheader{\purchaseOrderNo}
\addvspace{8ex}
{\Large DATE: \textit{\Date}}
\addvspace{2ex}
{\Large FOR: \textit{\clientName}}
\addvspace{4ex}
\hspace{-.9\marginparwidth}%
\colorbox{Mblue}{\begin{minipage}{\paperwidth}%
\vspace{.3in}
\begin{hoursItemization}
%
%%%%%%%%%%%%%%%%%% TABLE OF EXPENSES %%%%%%%%%%%%%%%%%%
%
% Put your expenses here in this order: \lineitem{QTY}{PRICE}{ITEM}
%
\lineitem{1}{3075}{550 Litre indirect Storage Vessel with Unvented Kit}
%
\lineitem{2}{214}{3 kW Aquarius Towel Rail Heating Element with Chrome Finish}
%
\lineitem{1}{225}{9 kW Stainless Steel Immersion Heater}
%------------------------------------------------------
%
%%%%%%%%%%%%%%%%%%% SUMMARY SECTION %%%%%%%%%%%%%%%%%%%
%
\beginsummary
%
\summaryline{SUBTOTAL}{\InvoiceTotal}
%
\summaryline{V.A.T. @ 20\%}{\vat}
%
\summaryline{TOTAL}{\total}
%------------------------------------------------------
%
\end{hoursItemization}
\vspace{.3in}
\end{minipage}}
\addvspace{10ex}
\begin{minipage}[t]{.3\textwidth}
{\bf SHIP TO:}\\
\textit{[email protected]}
\end{minipage}
\hfill
\begin{minipage}[t]{0.4\textwidth}
{\bf ADDITIONAL INFORMATION:}\\
\textit{We accept payment by cash or cheque. Payment Is due upon receipt, and must be paid in full within {\bf 30 days}.}
\end{minipage}
\end{document}
(该类文件很长 - 因此我不会发布,因为我认为没有必要解决这个问题)。
答案1
有很多选项,最简单的可能是\vfill
,它会将内容推到底部。由于我没有您的文档类,因此我在一个通用示例中说明了两个选项。其他选项包括包tikzpagenode
,它使 Ti 附带的绝对定位成为可能。钾Z 更容易。
\documentclass{article}
\usepackage{eso-pic} % only needed for the second option
\pagestyle{empty}
\begin{document}
First option: \verb|\vfill|
\vfill
Bottom--line: \verb|\vfill| works
\clearpage
Another option: use \texttt{eso-pic}
\AddToShipoutPicture{%
\AtTextUpperLeft{%
\put(0,-500){\begin{minipage}{\textwidth}
Bottom--line: also works. you may want to adjust the
$y$ value \texttt{500} to your needs. This option is particularly useful if
you want to write many pages with the same bottom--line.
\end{minipage}}%
}%
}
\end{document}
答案2
无需使用页脚,即可实现所需行为的一种简单方法是添加与强度因子相结合的 vspace。
\vspace*{\stretch{2}}
在两个小页面前添加运送到和附加信息。,将它们推到页面底部。该命令将根据上面添加的内容调整垂直空间。
答案3
我在您的页脚中看到的唯一问题是它不接受段落。对于您来说,这个问题很容易解决,\\[<length>]
因为您在那里有固定的内容。我fancyhdr
在我的 MWE 中使用了这个包,但是我不得不删除您的私人内容,因为我们无法访问它。见下文:
\documentclass[a4paper, 10pt]{article}
%% geometry package was used to build a page that was similar to yours
\usepackage[left=15mm,right=15mm]{geometry}
%% lipsum to create filler text
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
%% set the footer
\cfoot{
% \begin{tabular}{p{\linewidth}}
\begin{minipage}[t]{.3\textwidth}
{\bf SHIP TO:}\\[1mm] %% <- changed here
\textit{[email protected]}
\end{minipage}
\hfill
\begin{minipage}[t]{0.4\textwidth}
{\bf ADDITIONAL INFORMATION:}\\[1mm] %% <- changed here
\textit{We accept payment by cash or cheque. Payment Is due upon receipt, and must be paid in full within {\bf 30 days}.}
\end{minipage}
}
%% remove the top line, which is default in fancyhdr
\renewcommand{\headrulewidth}{0pt}
\begin{document}
\lipsum[1-20]
\end{document}
答案4
这也使用fancyhdr
,但允许下面的中央页面编号。(只是为了好玩,没有 tikz、表格或迷你页面)。
注意:\bf
是弃用的命令。使用 {\bfseries ...}
或\textbf{...}
\documentclass[a4paper]{article}
\usepackage{lipsum,parskip}
\usepackage[margin=2cm,bmargin=6cm,footskip=4cm]{geometry}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}%
\lfoot{\leavevmode
\vbox to 20ex{\hsize.6\linewidth{\bfseries SHIP TO:}\\[1ex]\itshape
[email protected]}%
\vbox to 20ex{\hsize.4\linewidth {\bfseries
ADDITIONAL INFORMATION:}\\[1ex]\normalfont\itshape
We accept payment by cash or cheque. Payment is due upon receipt,
and must be paid in full within {\bfseries 30 days}.}}
\pagestyle{fancy}
\begin{document}
\lipsum[1-50]
\end{document}