表格中同时使用强制换行和自动换行对不齐 #782
Answered
by
LogCreative
qiaoxiaoyue
asked this question in
提问
-
图片给了个例子,提出者一栏中使用\tabincell{c}强制换行并居中,后面优势特点和劣势不足两栏通过设置列宽令其自动换行,出现图中所示的上下无法对齐。 |
Beta Was this translation helpful? Give feedback.
Answered by
LogCreative
Apr 9, 2022
Replies: 2 comments 2 replies
-
\newcommand{\tabincell}[2]{\begin{tabular}[t]{@{}#1@{}}#2\end{tabular}}
\begin{document} % 添加 [t] 参数 更多信息可以参考 learnlatex.org 更多:表格。 MWE\documentclass{ctexart}
\usepackage{array}
\newcommand{\tabincell}[2]{\begin{tabular}[t]{@{}#1@{}}#2\end{tabular}}
\begin{document}
\begin{table}
\begin{tabular}{|l|l|l|p{3cm}|p{3cm}|}
\hline
\multicolumn{1}{|c|}{时间} & \multicolumn{1}{c|}{提出者} & \multicolumn{1}{c|}{原理} & \multicolumn{1}{c|}{优势特点} & \multicolumn{1}{c|}{劣势不足} \\
\hline
1985 & \tabincell{c}{Raugh M R \\ 斯坦福大学} & 群论 & 确定自校准基本模型,奠定理论基础 & 未实验论证,对噪声敏感 \\
\hline
\end{tabular}
\end{table}
\end{document} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
qiaoxiaoyue
-
直接用 MWE\documentclass{ctexart}
\usepackage{array}
\usepackage{makecell}
\renewcommand\theadfont{\normalsize}
\begin{document}
\begin{table}
\begin{tabular}{|l|l|l|m{3cm}|m{3cm}|}
\hline
\thead{时间} & \thead{提出者} & \thead{原理} & \thead{优势特点} & \thead{劣势不足} \\
\hline
1985 & \makecell{Raugh M R\\ 斯坦福大学} & 群论 & 确定自校准基本模型,奠定理论基础 & 未实验论证,对噪声敏感 \\
\hline
\end{tabular}
\end{table}
\end{document} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
\tabincell
应该是自定义的宏,或许你参考了 这个博客,那么你应当修改宏的定义为更多信息可以参考 learnlatex.org 更多:表格。
MWE