我一直在为工作制作 pars 封面。现在的效果是这样的。我试图让它看起来像我分享的图片,但很纠结。我该如何让我的 2 个 tabularx 像我分享的图片一样填满整个页面?
\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{geometry}
\geometry{margin=0.5in}
\begin{document}
\begin{center}
\includegraphics[width=0.5\textwidth]{logo.jpg}
Les XXXXX XXXX XXXXXX inc.\\
address \\
City, state\\
Postal code \\
TEL:(XXX) XXX-XXXX\\
FAX: (XXX) 655-XXXX\\
e-mail: [email protected]
\end{center}
\vspace{1cm}
\begin{tabularx}{\linewidth}{XX}
\TextField{TO:} & \TextField{SHIPMENT:} \\
\TextField{FROM:} & \TextField{ORDER:} \\
\TextField{DATE:}
\end{tabularx}
\bigskip
\noindent
\begin{tabularx}{\linewidth}{XX}
\TextField{PARS:}\\
\TextField{PORT OF ENTRY:}\\
\TextField{DATE OF ARRIVAL:}\\
\TextField{TIME OF ARRIVAL:}\\
\TextField{COMMENTS:}
\end{tabularx}
\end{document}
答案1
根据这个答案(https://tex.stackexchange.com/a/77633/42803):
\documentclass[a4paper]{article}
\usepackage{duckuments} % for sample image only
\usepackage[doublespacing]{setspace} % add line spacing
\usepackage[normalem]{ulem} % generates underlined text
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{geometry}
\geometry{margin=0.5in}
% source:
% https://tex.stackexchange.com/a/77633/42803
\newlength\TextFieldLength
\newcommand\TextFieldFill[1]{%
\setlength\TextFieldLength{\linewidth}%
\settowidth{\dimen0}{#1 }%
\addtolength\TextFieldLength{-\dimen0}%
\uline{\TextField[width=\TextFieldLength]{\raisebox{2pt}{#1}}}%
\vspace{6mm}%
}
\begin{document}
\begin{center}
\includegraphics[width=0.5\textwidth]{example-image-duck}
Les XXXXX XXXX XXXXXX inc.\\
address \\
City, state\\
Postal code \\
TEL:(XXX) XXX-XXXX\\
FAX: (XXX) 655-XXXX\\
e-mail: [email protected]
\end{center}
\vspace{1cm}
\begin{Form}
\def\DefaultHeightofText{14pt}
\noindent
\begin{tabularx}{\linewidth}{XX}
\TextFieldFill{TO: } & \TextFieldFill{SHIPMENT: } \\
\TextFieldFill{FROM: } & \TextFieldFill{ORDER: } \\
\TextFieldFill{DATE: } & \\[1.5cm]
\TextFieldFill{\textbf{PARS:} } & \\
\TextFieldFill{PORT OF ENTRY: } & \\
\TextFieldFill{DATE OF ARRIVAL: } & \\
\TextFieldFill{TIME OF ARRIVAL: } & \\
\TextFieldFill{COMMENTS: } & \\
\TextFieldFill{} & \\
\TextFieldFill{} & \\
\end{tabularx}
\end{Form}
\end{document}
答案2
使用
tabularray
-->rows=2cm
,您可以调整\TextField[width=5cm,height=1cm,borderstyle=U]{TO:}
在文档中hyperref
\vfill
填充当前页面剩余的垂直空间\documentclass[a4paper]{article} %https://tex.stackexchange.com/questions/669197/how-to-make-it-so-that-my-2-tables-fill-the-entire-page \usepackage{hyperref} \usepackage{graphicx} %\usepackage{tabularx} \usepackage{tabularray} \usepackage{geometry} \geometry{margin=0.5in} \begin{document} \begin{center} \includegraphics[width=0.5\textwidth]{example-image-a} Les XXXXX XXXX XXXXXX inc.\\ address \\ City, state\\ Postal code \\ TEL:(XXX) XXX-XXXX\\ FAX: (XXX) 655-XXXX\\ e-mail: [email protected] \end{center} \vfill \Large \begin{center} \begin{tblr} { rows=2cm, width=0.75\linewidth, colspec={*{2}{X[r]}}, } \TextField[width=5cm,height=1cm,borderstyle=U]{TO:}&\TextField{SHIPMENT:}\\ \TextField{FROM:} & \TextField{ORDER:} \\ \TextField{DATE:}\\ \TextField{PARS:} \end{tblr} \vfill \begin{tblr} { rows=1cm, width=0.5\linewidth, colspec={X[r]}, } \TextField{PORT OF ENTRY:}\\ \TextField{DATE OF ARRIVAL:}\\ \TextField{TIME OF ARRIVAL:}\\ \TextField{COMMENTS:} \end{tblr} \end{center} \end{document}