我有这个代码:
\begin{table}[H]
\begin{minipage}{\columnwidth}
\begin{center}
\begin{tabular}{p{3cm}|p{1cm}p{1cm}p{1cm}p{1cm}p{4.70cm}}
\toprule
Gesture & NDO & NSO & TNO & TNP & Characteristics \\
\hline
Goal & 1 & 1 & 2 &1& \tabitem Randomly distributed of static object.\\
Two Points & 1& 2 & 3 & 1 & \tabitem Randomly distributed of static.\\
\bottomrule
\end{tabular}
\end{center}
\bigskip\centering
\end{minipage}
\end{table}
- 这是我得到的。我的问题是:如何排列行?最后一列中的第一个项目未与行对齐。
答案1
有以下可能性:
\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage{array,float, tabularx, booktabs}
\usepackage{lipsum}
\def\tabitem{\textbullet\enspace}
\begin{document}
\lipsum[3]
\begin{table}[H]
\centering\footnotesize
\setlength{\tabcolsep}{3.5pt}
\setlength{\extrarowheight}{2pt}
\begin{tabularx}{\columnwidth}{@{}l|cccc >{\RaggedRight\arraybackslash}X@{}}
\toprule
Gesture & NDO & NSO & TNO & TNP & Characteristics \\
\specialrule{\lightrulewidth}{0pt}{0pt}
Goal & 1 & 1 & 2 &1& \tabitem Randomly distributed of static object.\\[1.5ex]
Two Points & 1& 2 & 3 & 1 & \tabitem Randomly distributed of static.\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
使用包enumitem
并为列表定义特殊类型的列类型:
\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage{array, booktabs, tabularx}
\usepackage{enumitem}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newcolumntype{I}{ >{\compress\itemize}X<{\vspace{-\baselineskip}\enditemize}}
\newcommand*{\mcbf}[1]{\multicolumn{1}{>{\bfseries}c}{#1}}
\usepackage{lipsum}
\begin{document}
\lipsum[3]
\begin{table}[htb]
\setlist[itemize]{wide}
\footnotesize
\setlength{\tabcolsep}{2pt}
\begin{tabularx}{\linewidth}{@{}l cccc >{\RaggedRight}I @{}}
\toprule
Gesture & NDO & NSO & TNO & TNP & \multicolumn{1}{c}{Characteristics} \\
\midrule
Goal & 1 & 1 & 2 & 1 & \item Randomly distributed of static object. \\
Two Points
& 1 & 2 & 3 & 1 & \item Randomly distributed of static.\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}