\documentclass[12pt]{article}
\begin{document}
\begin{center}
\begin{table}
\small
\caption{IT Administrators}
\begin{tabular}{p{2.25cm} l l l l}
Logon Name & {\footnotesize Jordan Orb\par} & {\footnotesize James Irving\par} & {\footnotesize Connor Green\par} & {\footnotesize George Gakpetor\par}\\
\\
Given Name & Jordan & James & Connor & George \\
Surname & Orb & Irving & Green & Gakpetor\\
\\
Password & \multicolumn{4}{c}{password\#1}\\
Company & \multicolumn{4}{c}{Team Dynamix}\\
\\
Office & 443.1 & 443.2 & 443 & 723 \\
{\footnotesize Phone Number\par} & (306)552-5531 & (306)552-5532 & \multicolumn{1}{p{2.5cm}}{(306)552-1124 ext 23} & (306)719-9704 \\
Email Address & \multicolumn{1}{p{2.5cm}}{{\footnotesize J.Orb \newline @teamdynamix.ca\par}} & \multicolumn{1}{p{2.5cm}}{{\footnotesize J.Irving \newline @teamdynamix.ca\par}} & \multicolumn{1}{p{2.5cm}}{{\footnotesize C.Green \newline @teamdynamix.ca\par}} & \multicolumn{1}{p{2.5cm}}{{\footnotesize G.Gakpetor \newline @teamdynamix.ca\par}} \\
Title & \multicolumn{1}{p{2.5cm}}{{\footnotesize IT Coordination Supervisor\par}} &\multicolumn{1}{p{2.5cm}}{{\footnotesize Senior IT Administrator\par}} & \multicolumn{1}{p{2.5cm}}{{\footnotesize Junior IT Administrator\par}} &\multicolumn{1}{p{2.5cm}}{{\footnotesize Vice President IT Administration \par}}\\
{\footnotesize Department, Organizational Unit, Group\par} & \multicolumn{4}{c}{IT Administrators} \\
City & \multicolumn{4}{c}{Regina}\\
Address& \multicolumn{4}{c}{1621 Albert St, Regina, SK S4P 2S5}\\
Country& \multicolumn{4}{c}{Canada}\\
Enabled& \multicolumn{4}{c}{Yes}\\
\end{tabular}
\end{table}
\end{center}
\end{document}
我希望 IT 管理员单元格沿部门、组织单位、组的中心垂直居中
答案1
这是一个解决方案makecell
,booktabs
可以简化您的代码:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{caption, booktabs, tabularx, makecell}
\newcommand{\nl}{\newline}
\begin{document}
\begin{table}
\small\centering\setlength{\tabcolsep}{3pt}
\renewcommand{\defaultaddspace}{2ex}
\renewcommand{\cellset}{\footnotesize}
\caption{IT Administrators}
\begin{tabularx}{\linewidth}{@{}p{2.25cm} *{4}{>{\arraybackslash}X}@{}}
Logon Name & \footnotesize Jordan Orb\ & \footnotesize James Irving & \footnotesize Connor Green & \footnotesize George Gakpetor \\
\addlinespace
Given Name & Jordan & James & Connor & George \\
Surname & Orb & Irving & Green & Gakpetor \\
\addlinespace
Password & \multicolumn{4}{c}{password\#1} \\
Company & \multicolumn{4}{c}{Team Dynamix} \\
\addlinespace
Office & 443.1 & 443.2 & 443 & 723 \\
\footnotesize Phone Number & (306)552-5531 & (306)552-5532 & (306)552-1124 ext 23 & (306)719-9704 \\
\addlinespace
Email Address & \footnotesize J.Orb \nl @teamdynamix.ca & \footnotesize J.Irving \newline @teamdynamix.ca & \footnotesize C.Green \nl @teamdynamix.ca & \footnotesize G.Gakpetor \nl @teamdynamix.ca \\
\addlinespace
Title & \footnotesize IT Coordination\nl Supervisor & \footnotesize Senior IT\nl Administrator & \footnotesize Junior IT\nl Administrator & \footnotesize Vice President IT\nl Administrator \\
\addlinespace
\makecell[lc]{\footnotesize{}Department, \\ Organizational \\Unit, Group} & \multicolumn{4}{c}{\makecell{IT Administrators}} \\
\addlinespace
City & \multicolumn{4}{c}{Regina} \\
Address & \multicolumn{4}{c}{1621 Albert St, Regina, SK S4P 2S5} \\
Country & \multicolumn{4}{c}{Canada} \\
Enabled & \multicolumn{4}{c}{Yes} \\
\end{tabularx}
\end{table}
\end{document}
答案2
- 对于单元格中的垂直居中文本,
p{...}
请使用m{...}
包中的列类型array
- newer 将浮动环境放入其中
\begin{center} ...\end{center}
- 您没有提供任何有关页面布局的信息,因此不知道纸张大小和文本宽度。它们在选择字体大小时很重要(不建议混合使用
\small
和字体大小)\footnotesize
- 使用
\makecell
包和宏简化表代码
编辑:编辑问题后我还建议这样做:
- 使用
tabular*
环境调整表格宽度以适应文本宽度 - 留给乳胶来确定尺寸
\tabcolsep
(列之间的距离) - 仅使用
\small
字体大小 - 稍微增加第一列的宽度:
- 使用
geometry
包定义页面布局
\documentclass[12pt]{article}
\usepackage[showframe,
margin=25mm]{geometry}
\usepackage{array, makecell}
\usepackage[skip=1ex]{caption}
\begin{document}
\begin{table}[ht]
\centering
\small
\caption{IT Administrators}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}m{2.5cm} l l l l}
Logon Name & { Jordan Orb} & { James Irving} & { Connor Green} & { George Gakpetor}\\
\\
Given Name & Jordan & James & Connor & George \\
Surname & Orb & Irving & Green & Gakpetor\\
\\
Password & \multicolumn{4}{c}{password\#1}\\
Company & \multicolumn{4}{c}{Team Dynamix}\\
\\
Office & 443.1 & 443.2 & 443 & 723 \\
{ Phone Number}
& (306)552-5531 & (306)552-5532 & (306)552-1124 & (306)719-9704 \\
& & & ext 23 & \\
Email Address & \makecell[t]{ J.Orb \\ @teamdynamix.ca}
& \makecell[t]{ J.Irving \\ @teamdynamix.ca}
& \makecell[t]{ C.Green \\ @teamdynamix.ca}
& \makecell[t]{ G.Gakpetor \\ @teamdynamix.ca} \\
Title & \makecell[t]{ IT Coordination\\ Supervisor}
& \makecell[t]{ Senior IT\\ Administrator}
& \makecell[t]{ Junior IT\\ Administrator}
& \makecell[t]{ Vice President IT\\ Administration}\\
{ Department, Organizational Unit, Group}
& \multicolumn{4}{c}{IT Administrators} \\
City & \multicolumn{4}{c}{Regina}\\
Address & \multicolumn{4}{c}{1621 Albert St, Regina, SK S4P 2S5}\\
Country & \multicolumn{4}{c}{Canada}\\
Enabled & \multicolumn{4}{c}{Yes}
\end{tabular*}
\end{table}
\end{document}