为什么 A1、B1 和 C1 没有对齐?不应该p
将它们对齐到顶部吗?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{adjustbox}
\usepackage{enumitem}
\usepackage{booktabs}
\usepackage{array}
\title{test}
\author{Me}
\date{July 2018}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}
\begin{adjustbox}{width=\textwidth}
\begin{tabular}{P{0.65\textwidth}P{0.65\textwidth}P{0.65\textwidth}}
\toprule
A & B & C\\
\bottomrule
\begin{itemize}[leftmargin=*]
\item A1
\begin{itemize}[leftmargin=*]
\item A2
\item A3
\item A4
\item A5
\item A6
\end{itemize}
\item A7
\item A8
\item A9
\item A10
\item A11
\item A12
\item A13
\end{itemize}
&
\begin{itemize}
\item B1
\begin{itemize}[leftmargin=*]
\item B2
\item B3
\item B4
\item B5
\end{itemize}
\item B6
\item B7
\begin{itemize}[leftmargin=*]
\item B8
\item B9
\item B10
\item B11
\end{itemize}
\end{itemize}
&
\begin{itemize}
\item C1
\begin{itemize}[leftmargin=*]
\item C2
\item C3
\item C4
\item C5
\item C6
\item C7
\end{itemize}
\item C8
\begin{itemize}[leftmargin=*]
\item C9
\item C10
\item C11
\end{itemize}
\item C12
\item C13
\end{itemize} \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
\end{document}
答案1
您不应该将其adjustbox
用于表格,因为这会导致字体大小不一致。最好使用 tabularx
具有固定总宽度的表格。以下是解决您问题的方法以及一些改进:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{booktabs}
\title{test}
\author{Me}
\date{July 2018}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newcolumntype{P}[1]{>{\centering\arraybackslash\compress}p{#1}}
\begin{document}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabularx}{\linewidth}{*{3}{>{\centering\arraybackslash\compress}X}}
\toprule
A & B & C\\
\midrule[\heavyrulewidth]
\begin{itemize}[leftmargin=*]
\item A1
\begin{itemize}[leftmargin=*]
\item A2
\item A3
\item A4
\item A5
\item A6
\end{itemize}
\item A7
\item A8
\item A9
\item A10
\item A11
\item A12
\item A13
\end{itemize}
&
\begin{itemize}
\item B1
\begin{itemize}[leftmargin=*]
\item B2
\item B3
\item B4
\item B5
\end{itemize}
\item B6
\item B7
\begin{itemize}[leftmargin=*]
\item B8
\item B9
\item B10
\item B11
\end{itemize}
\end{itemize}
&
\begin{itemize}
\item C1
\begin{itemize}[wide =0pt, leftmargin=*]
\item C2
\item C3
\item C4
\item C5
\item C6
\item C7
\end{itemize}
\item C8
\begin{itemize}[wide =0pt, leftmargin=*]
\item C9
\item C10
\item C11
\end{itemize}
\item C12
\item C13
\end{itemize} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}