我正在尝试为我的公司创建一个表单。我是 Latex 的新手,根据一些教程,我能够达到一定的水平。但正如你所见
fbox
从不同的边距开始- 我试图让该段落移动到靠近第一个表格的位置。
- 以箭头开头的表格似乎在边距之前开始,我该如何对齐它们
- 我试图让“单位持有人信息”的下划线与底线相匹配,
fbox
并将其延伸至该行的其余部分。4.
任何帮助都将不胜感激。
\documentclass[a4paper,10pt]{report}
\usepackage[margin=0.45cm]{geometry}
\usepackage[utf8]{inputenc}
\newenvironment{nscenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
\newcommand{\myheading}[1]{
\fbox{\phantom{\rule{.7ex}{.7ex}}}\hspace{1pt}\underline{\textbf{#1}\hfill}\tabularnewline
}
\usepackage{array}
\usepackage{ulem}
\usepackage{hyperref,wasysym}
\usepackage{pifont}
\begin{document}
\begin{nscenter}
\textbf{\Large ABC COMPANY Transaction Form}{\footnotesize (For existing unit holders only)}
\end{nscenter}
\setlength{\arrayrulewidth}{1pt}
\setlength{\tabcolsep}{1pt}
\footnotesize
\begin{tabular}{|>{\centering}p{4.2cm}|>{\centering}p{4.0cm}|>{\centering}p{3.9cm}|>{\centering}p{3.1cm}|>{\centering}p{3.0cm}|}
\hline
Broker ARN & Sub Broker/Branch Code & Sub-Broker ARN & EUIN & Date\tabularnewline
\hline
{\textbf{\large ABC 12345}} & &{\textbf{\normalsize A012344}} & &\underline{${}$\hspace{0.6cm}}/\underline{${}$\hspace{0.6cm}}/\underline{${}$\hspace{1.0cm}} \tabularnewline[1.0pt]
\hline
\end{tabular}\\
\normalsize
\fboxrule=1pt \fbox{\phantom{\rule{2.7ex}{2.7ex}}} \fbox{\parskip=0pt\parbox[t]{0.90\textwidth}{\raggedright{}{\tiny I/We hereby confirm that the EUIN box has been intentionally left blank by me/us as this is an “execution-only” transaction without any interaction or advice by the employee/relationship manager/sales person of the above distributor or notwithstanding the advice of in-appropriateness, if any, provided by the employee/relationship manager/sales person of the distributor and the distributor has not charged any advisory fees on this transaction.\par}}}\\
\hspace{0.5cm}
\setlength{\arrayrulewidth}{1pt}
\setlength{\tabcolsep}{1pt}
\scriptsize
\begin{tabular}{p{2.3cm}|p{4.4cm}|p{1.9cm}|p{3.7cm}|p{1.8cm}|p{4.5cm}}
\hline
{\textbf{\huge\hspace{4pt}\ding{220}}}\parbox[t] {0.85\textwidth}{Sole/First\\ unit Holder}& &\parbox[t]{0.85\textwidth}{Second \\unit Holder}& &\parbox[t]{0.85\textwidth}{Third\\ unit holder}& \tabularnewline
\hline
\end{tabular}\\\\
\normalsize
\underline{\textbf{ABC Company Transfer}}\\
\myheading{Unit Holder Information}\\
\end{document}
答案1
另外,使用makecell
包可以获得更好的垂直间距并hhline
形成正方形。无需nscenter
环境。
\documentclass[a4paper,10pt]{report}
\usepackage[margin=0.45cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Verdana}
\usepackage{array, tabularx}
\usepackage{hhline}
\usepackage{ulem}
\usepackage{hyperref,wasysym}
\usepackage{pifont}
\parindent = 0pt
\setlength{\fboxrule}{1pt}
\setlength{\arrayrulewidth}{1pt}
\setlength{\tabcolsep}{3pt}
\setlength{\doublerulesep}{5pt}
\newlength{\sqside}
\setlength{\sqside}{2.85ex }
\usepackage{makecell}
\begin{document}
\footnotesize
\begin{tabular}{|>{\centering}p{4.2cm}|>{\centering}p{4.0cm}| >{\centering}p{3.9cm}| >{\centering}p{3.1cm}| >{\centering}p{3.0cm}|}
\multicolumn{5}{c}{{\bfseries\Large ABC COMPANY Transaction Form} (For existing unit holders only)}\\[2ex]
\hline
\makecell*{Broker ARN} & Sub Broker/Branch Code & Sub-Broker ARN & EUIN & Date\tabularnewline
\hline%
\makecell*{\bfseries\large ABC 12345} & &{\bfseries\normalsize A012344} & & \raisebox{0pt}[0pt][0pt]{\underline{${}$\hspace{0.6cm}} / \underline{${}$\hspace{0.6cm}} / \underline{${}$\hspace{1.0cm}}}\tabularnewline[1.0pt]
\hline
\end{tabular}\bigskip
\begin{tabularx}{\dimexpr 18.2cm + 10\tabcolsep + 6\arrayrulewidth\relax}{|l||>{\tiny}X|}
\hhline{|-||-|}
\makebox[\sqside][c]{} & I/We hereby confirm that the EUIN box has been intentionally left blank by me/us as this is an “execution-only” transaction without any interaction or advice by the employee/relationship manager/sales person of the above distributor or notwithstanding the advice of in-appropriateness, if any, provided by the employee/relationship manager/sales person of the distributor and the distributor has not charged any advisory fees on this transaction. \\
\hhline{|-||-|}
\end{tabularx}\\[10pt]
\hspace{0.5cm}
\scriptsize
\begin{tabularx}{\dimexpr 18.2cm + 10\tabcolsep + 6\arrayrulewidth\relax}{ll|X|l|X|l|X}
\hline
\makecell{\textbf{\huge\ding{220}}} & \makecell*{Sole/First\\ unit Holder}& &\makecell{Second \\unit Holder}& &\makecell{Third\\ unit Holder}& \tabularnewline
\hline
\end{tabularx}
\mbox{}\\[6ex]
{\normalsize\bfseries
\begin{tabular}{|l|l@{}}
\multicolumn{2}{@{}l}{\underline{\normalsize\bfseries ABC Company Transfer}}\\[6pt]
\cline{1-1}
\makebox[0.92ex][c]{}& Unit Holder Information \\
\hline
\end{tabular}}
\end{document}
答案2
表格周围有一些间距。保持内容对齐的最简单方法是将其保持在表格中。但是,在这种情况下,您需要不同的列规范。因此,最好使用宽度均匀的表格。您可以tabular*
像我对其中一个表格所做的那样使用它,但我还使用了tabularx
包。这要求至少有一列是“可拉伸的”,因为它会调整列宽而不是列间距。我还使用了它,array
它允许我使用更多选项来指定列。
\documentclass[a4paper,10pt]{report}
\usepackage[margin=0.45cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Verdana}
\newenvironment{nscenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
\usepackage{array,tabularx}% tabularx would load array anyway but include for transparency
\newcolumntype{C}[1]{>{\centering}m{#1}}% this defines a new column type which will centre the contents horizontally and vertically in a parbox of specified width
\usepackage{ulem}
\usepackage{hyperref,wasysym}
\usepackage{pifont}
\begin{document}
\begin{nscenter}
\textbf{\Large ABC COMPANY Transaction Form\footnotesize (For existing unit holders only)}
\end{nscenter}
{\centering% we don't want stray spaces messing up the alignment so comment the ends of lines
\setlength{\arrayrulewidth}{1pt}%
\setlength{\tabcolsep}{1pt}%
\footnotesize%
\noindent%
\begin{tabularx}{.975\textwidth}{|C{4.2cm}|C{4.0cm}|C{3.9cm}|C{3.1cm}|>{\centering}X|}% a tabular of width .975\textwidth - at least one column must be X so that tabularx can adjust it to match the request width. This won't get centred automatically, so centre it explicitly
\hline
Broker ARN & Sub Broker/Branch Code & Sub-Broker ARN & EUIN & Date\tabularnewline
\hline
\textbf{\large ABC 12345} & & \textbf{\normalsize A012344} & &\underline{\hspace{0.6cm}}/\underline{\hspace{0.6cm}}/\underline{\hspace{1.0cm}}\tabularnewline[1.0pt]
\hline
\end{tabularx}\\
\normalsize%
\fboxrule=1pt%
\begin{tabularx}{.975\textwidth}{l>{\centering}X}% just for alignment - one column which obviously has to be X
\fbox{\phantom{\rule{2.7ex}{2.7ex}}} &
\fbox{\parskip=0pt\parbox[b]{0.90\textwidth}{\raggedright\tiny I/We hereby confirm that the EUIN box has been intentionally left blank by me/us as this is an “execution-only” transaction without any interaction or advice by the employee/relationship manager/sales person of the above distributor or notwithstanding the advice of in-appropriateness, if any, provided by the employee/relationship manager/sales person of the distributor and the distributor has not charged any advisory fees on this transaction.}}\tabularnewline
\end{tabularx}\\
\scriptsize%
\begin{tabular*}{.975\textwidth}{p{2.3cm}|p{4.4cm}|p{1.9cm}|p{3.7cm}|p{1.8cm}|p{4.5cm}}% a tabular* so no need for X here
\hline
\raisebox{-8pt}[-4pt][0pt]{\textbf{\huge\hspace{4pt}\ding{220}}}\parbox[t]{0.85\textwidth}{Sole/First\\unit Holder}& &\parbox[t]{0.85\textwidth}{Second\\unit Holder}& &\parbox[t]{0.85\textwidth}{Third\\unit holder}& \tabularnewline
\hline
\end{tabular*}
\medskip\\
\normalsize%
\begin{tabularx}{.975\textwidth}{X}% another tabular just for alignment
\underline{\textbf{ABC Company Transfer}}\tabularnewline
\end{tabularx}\\
\begin{tabularx}{.975\textwidth}{m{1.25em}>{\bfseries}X}% a very narrow column, vertically centred for the box followed by the stretchy column
\fbox{\phantom{\rule{.7ex}{.7ex}}} & Unit Holder Information
\tabularnewline\cline{2-2}% using cline to underline ensures the line runs the full width
\end{tabularx}\\
}
\end{document}