\documentclass{article}
\begin{document}
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
Type of Variation & C& B\\
\hline \hline
SNP &
\begin{center}
\begin{tabular}[t]{cccc}
\centering
1&2&3&4\\ A&C&G&T\\ A&T&G&T
\end{tabular}
\end{center}\\ &&
\begin{center}
\begin{tabular}[t]{ccc}
POS & REF & ALT\\
2 & C & T \\
\end{tabular}
\end{center}\\ \hline
\end{tabular}
\end{center}
\end{table}
\end{document}
答案1
我怀疑以下内容可能就是您要找的内容。请注意,所有center
环境都已被删除,\centering
在最外层环境之前立即提供了一条指令tabular
,提供了缺少的\begin{table}
指令,并且外部环境中的列数tabular
从 4 减少到 3。
\documentclass{article}
\usepackage{array} % for "\extrarowheight" macro
\usepackage[skip=0.333\baselineskip]{caption}
\begin{document}
\begin{table}
\setlength\extrarowheight{2pt} % for a slightly more open "look"
\centering
\caption{Nested \texttt{tabular} environments}
\begin{tabular}{|c|c|c|}
\hline
Type of Variation & C & B \\
\hline \hline
SNP &
\begin{tabular}[t]{@{}cccc@{}} % "@{}" omits side padding
1&2&3&4 \\
A&C&G&T \\
A&T&G&T \\
\end{tabular} &
\begin{tabular}[t]{@{}ccc@{}}
POS & REF & ALT\\
2 & C & T \\
\end{tabular} \\
\hline
\end{tabular}
\end{table}
\end{document}