我在表格中看到列宽不同,但无法纠正。最后一行(带有文本成员)有多列,宽度不均匀。请帮忙。
这是一个示例代码。
\begin{table*}[h!]
\centering
\vspace{0.5em}
\setlength\extrarowheight{2pt}
\noindent
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{1}{|l}{\small \textbf{Progress of the Candidate:}} & \multicolumn{3}{c|} {\small \textbf{Excellent/Good/Satisfactory/Unsatisfactory}} \\[1ex] \hline
\multicolumn{4}{|l|}{\small \textbf{Remarks:}} \\[10ex] \hline
\multicolumn{4}{|l|}{}\\[3em]
\multicolumn{2}{|l}{$\overline{\strut \small \textbf{Signature(s) \& Names(s) of Guide(s)}}$ } & \multicolumn{2}{l|}{\hspace{12em}\small \textbf{Date}} \\[0.5em] \hline
\multicolumn{4}{|l|}{}\\[3em] \hline
\small \textbf{Member 1} & \small \textbf{Member 2} & \small \textbf{Member 3} & \small \textbf{Member 4} \\
\multicolumn{4}{|c|}{\small \textbf{Signature \& Names of DC Members}} \\ \hline
\end{tabular}
\end{table*}
答案1
这是一个tabularx
解决方案,因为第一行的内容长度超过了 4 列,导致 OP 错位。基本上,X 列用于自动调整宽度,并且具有由newcolumntype
命令定义的样式
\newcolumntype{C}{>{\centering\arraybackslash}X}
代码
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{array,tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table*}[h!]
\centering
\vspace{0.5em}
\setlength\extrarowheight{2pt}
\noindent
\begin{tabularx}{\textwidth}{|C|C|C|C|}
\hline
\multicolumn{2}{|l}{\small \textbf{Progress of the Candidate:}} & \multicolumn{2}{c|} {\small \textbf{Excellent/Good/Satisfactory/Unsatisfactory}}
\\[1ex] \hline
\multicolumn{4}{|l|}{\small \textbf{Remarks:}} \\[10ex] \hline
\multicolumn{4}{|l|}{}\\[3em]
\multicolumn{2}{|l}{$\overline{\strut \small \textbf{Signature(s) \& Names(s) of Guide(s)}}$} & \multicolumn{2}{l|}{\hfill \small \textbf{Date}} \\[0.5em] \hline
\multicolumn{4}{|l|}{}\\[3em] \hline
\small \textbf{Member 1} &
\small \textbf{Member 2} &
\small \textbf{Member 3} &
\small \textbf{Member 4} \\
\multicolumn{4}{|c|}{\small \textbf{Signature \& Names of DC Members}} \\ \hline
\end{tabularx}
\end{table*}
答案2
没有tabularx
。
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{array,amsmath}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table*}[h!]
\centering
\vspace{0.5em}
\setlength\extrarowheight{2pt}
\noindent
\begin{tabular}{*{4}{|C{\dimexpr0.25\textwidth-2\tabcolsep-2\arrayrulewidth\relax}}|}
\hline
\multicolumn{2}{|l}{\small \textbf{Progress of the Candidate:}} & \multicolumn{2}{c|} {\small \textbf{Excellent/Good/Satisfactory/Unsatisfactory}}
\\[1ex] \hline
\multicolumn{4}{|l|}{\small \textbf{Remarks:}} \\[10ex] \hline
\multicolumn{4}{|l|}{}\\[3em]
\multicolumn{2}{|l}{$\overline{\strut\text{\small \textbf{Signature(s) \& Names(s) of Guide(s)}}}$} & \multicolumn{2}{l|}{\hfill \small \textbf{Date}} \\[0.5em] \hline
\multicolumn{4}{|l|}{}\\[3em] \hline
\small \textbf{Member 1} &
\small \textbf{Member 2} &
\small \textbf{Member 3} &
\small \textbf{Member 4} \\
\multicolumn{4}{|c|}{\small \textbf{Signature \& Names of DC Members}} \\ \hline
\end{tabular}
\end{table*}
\end{document}
请注意,small
在数学模式下无效。因此我使用了包\text
中的宏amsmath
。