我有一张有两列的表格,每列的宽度都是固定的。有时左侧文本是一行,右侧文本是两行。因此,左侧文本与右侧两行之间的空白对齐。
有没有什么办法可以让我将其分隔开来,以便两个顶行与左侧单个值下方的空白行所占用的额外空间齐平?
标记:
\documentclass[10pt]{book}
\usepackage{subcaption}
\usepackage{url}
\usepackage{array}
\begin{document}
\begin{center}
\begin{tabular}{| >{\centering\arraybackslash}m{5.4cm} >{\centering\arraybackslash}m{5.4cm} |}
\hline
Traditional Care & Technological Care\\
\hline
Patient to keep a diary for appointments. & Automated calendar reminder to phone.\\
Important items to be kept in the same place. & Alarmed receiver attached to important objects.\\
Put labels on doors/cupboards. & Wearable camera to recognise and remind doors/cupboards.\\
Place important numbers by the phone. & Phone with pre-stored numbers represented by familiar faces.\\
Place note on back of door as reminder to take keys. & Door sensor to remind occupant to take keys when door is opened.\\
Label family photographs. & Facial recognition to act as a reminder.\\
Pin a weekly timetable to the wall. & Automated calendar reminder to phone/wall mounted monitor.\\
Write reminders to lock door at night, turn off gas, put rubbish out etc. & Automated systems in house to turn off systems/lock doors at certain times, automated reminders.\\
\hline
\end{tabular}
\captionof{table}{Comparison of differing provisions of care for ADL.}
\label{tab:activityList}
\end{center}
\end{document}
答案1
您只需将m
-column(垂直居中)替换为p
与顶部对齐的 -column。
以下是我布置餐桌的方式:
% arara: pdflatex
\documentclass[10pt]{book}
\usepackage[english]{babel}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{microtype}
\begin{document}
\begin{table}
\centering
\begin{tabular}{>{\RaggedRight}p{5.6cm} >{\RaggedRight}p{5.6cm} }
\toprule
\centering Traditional Care & \centering\arraybackslash Technological Care\\
\midrule
Patient to keep a diary for appointments. & Automated calendar reminder to phone.\\\addlinespace
Important items to be kept in the same place. & Alarmed receiver attached to important objects.\\\addlinespace
Put labels on doors/cupboards. & Wearable camera to recognise and remind doors/cupboards.\\\addlinespace
Place important numbers by the phone. & Phone with pre-stored numbers represented by familiar faces.\\\addlinespace
Place note on back of door as reminder to take keys. & Door sensor to remind occupant to take keys when door is opened.\\\addlinespace
Label family photographs. & Facial recognition to act as a reminder.\\\addlinespace
Pin a weekly timetable to the wall. & Automated calendar reminder to phone/wall mounted monitor.\\\addlinespace
Write reminders to lock door at night, turn off gas, put rubbish out etc. & Automated systems in house to turn off systems/lock doors at certain times, automated reminders.\\
\bottomrule
\end{tabular}
\caption{Comparison of differing provisions of care for ADL.}
\label{tab:activityList}
\end{table}
\end{document}
答案2
更多的是评论,而不是答案,但我不允许评论:你不能添加一个空行吗?
或者:看这里:高度可变的表格单元格中的垂直对齐
答案3
表格规范p
为您提供了一个»文本在中间垂直对齐的段落列«。要垂直对齐顶部和水平居中,则c
需要该规范 - 这反过来会给您带来宽度问题。
可以找到两个有用的解决方案高度可变的表格单元格中的垂直对齐- 基本上,这个想法是通过使用框及其相对于周围环境的对齐来给出列的宽度。