有没有办法自动将表格内容移到第二行?
我的 MWE:
\documentclass[12pt,oneside]{book}
\usepackage{geometry}
\usepackage[svgnames, table]{xcolor}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx, threeparttable}
\renewcommand\theadfont{\small\bfseries} % for column headers
\renewcommand\theadgape{}
\usepackage{siunitx}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular}{lllll}
\toprule
\textbf{Year} & \textbf{Name} & \textbf{Reference} & \textbf{Note} \\
\midrule
1998 & \textit{Computer Science Branch} & Herrera et al., 2004 & codingnot working and no further update since 1998 \\
\bottomrule
\end{tabular}
\end{table}
\end {document}
答案1
对最后一列使用固定宽度的列说明符,例如X
列类型:
\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage[svgnames, table]{xcolor}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx, threeparttable}
\renewcommand\theadfont{\small\bfseries} % for column headers
\renewcommand\theadgape{}
\usepackage{siunitx}
\usepackage{lipsum}
\begin{document}
\begin{table}[h!]
\centering \setlength{\tabcolsep}{4pt}
\begin{tabularx}{\linewidth}{lllX}
\toprule
\textbf{Year} & \textbf{Name} & \textbf{Reference} & \textbf{Note} \\
\midrule
1998 & \textit{Computer Science Branch} & Herrera et al., 2004 & coding not working and no further update since 1998 \\
\bottomrule
\end{tabularx}
\end{table}
\end {document}