LaTeX 表格线未连接

LaTeX 表格线未连接

在此处输入图片描述

我的表格的线条没有连接。
我需要一张每条线条都应连接的表格。

该表的 LaTeX 代码如下:

\begin{table}[]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|ccccccccccccc|}
\hline
\multirow{2}{*}{Constant Value of the real part} & \multicolumn{13}{c|}{Binary representation of real part} \\ \cline{2-14} 
 & \multicolumn{1}{c|}{20} & \multicolumn{2}{c|}{2-1} & \multicolumn{1}{c|}{2-2} & \multicolumn{1}{c|}{2-3} & \multicolumn{1}{c|}{2-4} & \multicolumn{1}{c|}{2-5} & \multicolumn{1}{c|}{2-6} & \multicolumn{1}{c|}{2-7} & \multicolumn{1}{c|}{2-8} & \multicolumn{1}{c|}{2-9} & \multicolumn{1}{c|}{2-10} & 2-11 \\ \hline
0.9988 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & 1 \\ \hline
0.9952 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & 0 \\ \hline
0.9892 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 1 \\ \hline
0.9808 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0 \\ \hline
0.9697 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & 0 \\ \hline
0.9569 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & -1 \\ \hline
0.9415 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0 \\ \hline
0.9239 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & 0 \\ \hline
0.9040 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & -1 \\ \hline
0.8819 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & 0 \\ \hline
0.8577 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & 0 \\ \hline
0.8315 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & 0 \\ \hline
0.8032 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & 0 \\ \hline
0.7730 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 1 \\ \hline
0.7410 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & 1 \\ \hline
0.7071 & \multicolumn{2}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{-1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0 \\ \hline
\end{tabular}%
}
\end{table}

答案1

问题是,在您的代码中,您\multicolumn{2}{}{}在第二列中使用了它,但在第二行中,您在第三列中使用它。这当然是不对齐的。

我假设您提供的代码是由某个表格生成器生成的,而这些表格生成器通常会生成难以阅读且难以维护的代码。因此,我建议您清理代码并删除所有这些不必要的\multicolumn命令。这样事情就会变得容易得多,而且不需要缩放表格,\resizebox这是一种不好的做法,因为它会扭曲字体大小:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{multirow}

\begin{document}
    
\begin{tabular}{ | *{13}{c|} }
\hline
\multirow{2}{2.5cm}{\centering Constant Value of the real part} & 
    \multicolumn{12}{c|}{Binary representation of real part} \\ \cline{2-13} 
 & 20 & 2-1 & 2-2 & 2-3 & 2-4 & 2-5 & 2-6 & 2-7 & 2-8 & 2-9 & 2-10 & 2-11 \\ \hline
0.9988 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 \\ \hline
0.9952 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 \\ \hline
0.9892 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 1 \\ \hline
0.9808 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 0 \\ \hline
0.9697 & 1 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 \\ \hline
0.9569 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 1 & 0 & 0 & -1 \\ \hline
0.9415 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ \hline
0.9239 & 1 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 1 & 0 & 0 \\ \hline
0.9040 & 1 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & -1 \\ \hline
0.8819 & 1 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & -1 & 0 \\ \hline
0.8577 & 1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 \\ \hline
0.8315 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & -1 & 0 \\ \hline
0.8032 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 \\ \hline
0.7730 & 1 & 0 & -1 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 1 \\ \hline
0.7410 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 1 \\ \hline
0.7071 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\ \hline
\end{tabular}
    
\end{document}

在此处输入图片描述

为了正确排版减号,您可能需要在相关单元格中使用数学模式(感谢 Mico 的提示):

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array, multirow}
\newcolumntype{C}{>{$}c<{$}}

\begin{document}

\begin{tabular}{ | *{13}{C|} }
\hline
\multirow{2}{2.5cm}{\centering Constant Value of the real part} & 
    \multicolumn{12}{c|}{Binary representation of real part} \\ \cline{2-13} 
 & \textrm{2-0} & \textrm{2-1} & \textrm{2-2} & \textrm{2-3} & \textrm{2-4} & \textrm{2-5} & \textrm{2-6} & \textrm{2-7} & \textrm{2-8} & \textrm{2-9} & \textrm{2-10} & \textrm{2-11} \\ \hline
0.9988 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 \\ \hline
0.9952 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 \\ \hline
0.9892 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 1 \\ \hline
0.9808 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 0 \\ \hline
0.9697 & 1 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 \\ \hline
0.9569 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 1 & 0 & 0 & -1 \\ \hline
0.9415 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ \hline
0.9239 & 1 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 1 & 0 & 0 \\ \hline
0.9040 & 1 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & -1 \\ \hline
0.8819 & 1 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & -1 & 0 \\ \hline
0.8577 & 1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 \\ \hline
0.8315 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & -1 & 0 \\ \hline
0.8032 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 \\ \hline
0.7730 & 1 & 0 & -1 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 1 \\ \hline
0.7410 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 1 \\ \hline
0.7071 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\ \hline
\end{tabular}

\end{document}

在此处输入图片描述


另一种方法是使用该booktabs包并完全删除垂直规则:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array, multirow, booktabs}
\newcolumntype{C}{>{$}c<{$}}

\begin{document}

\begin{tabular}{ *{13}{C} }
\toprule
 & \multicolumn{12}{c}{Binary representation of real part} \\ \cmidrule{2-13} 
\multirow{-2}{2.5cm}{\centering Constant Value of the real part} 
 & \textrm{2-0} & \textrm{2-1} & \textrm{2-2} & \textrm{2-3} & \textrm{2-4} & \textrm{2-5} & \textrm{2-6} & \textrm{2-7} & \textrm{2-8} & \textrm{2-9} & \textrm{2-10} & \textrm{2-11} \\ 
\midrule
0.9988 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 \\ 
0.9952 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 \\ 
0.9892 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 1 \\ 
0.9808 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 0 \\ 
0.9697 & 1 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 \\ 
0.9569 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 1 & 0 & 0 & -1 \\ 
0.9415 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 
0.9239 & 1 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 1 & 0 & 0 \\ 
0.9040 & 1 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & -1 \\ 
0.8819 & 1 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & -1 & 0 \\ 
0.8577 & 1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 \\ 
0.8315 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & -1 & 0 \\ 
0.8032 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 \\ 
0.7730 & 1 & 0 & -1 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 1 \\ 
0.7410 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 1 \\ 
0.7071 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\ 
\bottomrule
\end{tabular}

\end{document}

在此处输入图片描述

答案2

我建议您使用tabular*环境来确保表格适合文本块,或者,表格的宽度等于\textwidth。我还会确保 12 个数据列的宽度相等,并将数字与隐含的小数点对齐。哦,我还会删除所有垂直规则,并使用更少但间距适当的水平规则。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath,booktabs,siunitx}
\newcommand\mytab[1]{\smash[b]{%
   \begin{tabular}[t]{@{}l@{}} #1 \end{tabular}}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}

\begin{table}
\setlength\tabcolsep{0pt} % make LaTeX figure out the amount of intercolumn whitespace

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
    c 
    *{12}{S[table-format=-1.0]} @{}}
\toprule
\mytab{Constant value\\of real part} & 
\multicolumn{12}{c}{Binary representation of real part} \\ 
\cmidrule{2-13} 
  & \mc{2-0} & \mc{2-1} & \mc{2-2} & \mc{2-3} 
  & \mc{2-4} & \mc{2-5} & \mc{2-6} & \mc{2-7} 
  & \mc{2-8} & \mc{2-9} & \mc{\llap{2}-10}& \mc{\llap{2}-11} \\ 
\midrule
0.9988 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 \\
0.9952 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 \\
0.9892 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 &  0 &  0 &  1 \\
0.9808 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  0 \\
\addlinespace
0.9697 & 1 & 0 &  0 &  0 &  0 & -1 &  0 &  0 &  0 &  0 &  1 &  0 \\
0.9569 & 1 & 0 &  0 &  0 & -1 &  0 &  1 &  0 &  1 &  0 &  0 & -1 \\
0.9415 & 1 & 0 &  0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 &  0 \\
0.9239 & 1 & 0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  1 &  0 &  0 \\
\addlinespace
0.9040 & 1 & 0 &  0 & -1 &  0 &  1 &  0 &  0 &  0 & -1 &  0 & -1 \\
0.8819 & 1 & 0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 & -1 &  0 \\
0.8577 & 1 & 0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 \\
0.8315 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 & -1 &  0 \\
\addlinespace
0.8032 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 \\
0.7730 & 1 & 0 & -1 &  0 &  0 &  1 &  0 & -1 &  0 &  0 &  0 &  1 \\
0.7410 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  1 \\
0.7071 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 &  0 &  0 \\ 
\bottomrule
\end{tabular*}

\end{table}

\end{document} 

答案3

我猜你是某些软件的受害者,这些软件声称能为表格生成良好的代码。显然,\multicolumn声明每一个列中的条目。

此外,该软件的列数也错误。

booktabs这是使用和自动调整列间空间大小的另一种实现方式。避免调整大小。

\documentclass{article}
\usepackage{amsmath}
\usepackage{array,booktabs}

\begin{document}

\begin{table}[htp]
\centering\small

\setlength{\tabcolsep}{0pt}% let TeX compute
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  c
  *{12}{>{$}c<{$}}
}
\toprule
\smash{\begin{tabular}[t]{@{}c@{}} Real \\ part \end{tabular}}
& \multicolumn{12}{c}{Binary representation of real part} \\
\cmidrule{2-13}
& \text{2--0}
& \text{2--1} & \text{2--2} & \text{2--3} & \text{2--4} 
& \text{2--5} & \text{2--6} & \text{2--7} & \text{2--8} 
& \text{2--9} & \text{2--10} & \text{2--11} \\
\midrule
0.9988 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 \\
0.9952 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 \\
0.9892 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 &  0 &  0 &  1 \\
0.9808 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  0 \\
0.9697 & 1 & 0 &  0 &  0 &  0 & -1 &  0 &  0 &  0 &  0 &  1 &  0 \\
0.9569 & 1 & 0 &  0 &  0 & -1 &  0 &  1 &  0 &  1 &  0 &  0 & -1 \\
0.9415 & 1 & 0 &  0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 &  0 \\
0.9239 & 1 & 0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  1 &  0 &  0 \\
0.9040 & 1 & 0 &  0 & -1 &  0 &  1 &  0 &  0 &  0 & -1 &  0 & -1 \\
0.8819 & 1 & 0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 & -1 &  0 \\
0.8577 & 1 & 0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 \\
0.8315 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 & -1 &  0 \\
0.8032 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 \\
0.7730 & 1 & 0 & -1 &  0 &  0 &  1 &  0 & -1 &  0 &  0 &  0 &  1 \\
0.7410 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  1 \\
0.7071 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 &  0 &  0 \\
\bottomrule
\end{tabular*}

\end{table}

\end{document}

在此处输入图片描述

我认为“实部的常数值”并不比“实部”更清楚。

如果你真的想要一张带笼子的桌子

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{table}[htp]
\centering\footnotesize

\addtolength{\tabcolsep}{-.066pt}

\begin{tabular}{
  |c|
  *{12}{>{$}c<{$}|}
}
\hline
\smash{\begin{tabular}[t]{@{}c@{}}Real \\ part \end{tabular}} &
\multicolumn{12}{c|}{Binary representation of real part} \\
\cline{2-13}
& \text{2--0}
& \text{2--1} & \text{2--2} & \text{2--3} & \text{2--4} 
& \text{2--5} & \text{2--6} & \text{2--7} & \text{2--8} 
& \text{2--9} & \text{2--10} & \text{2--11} \\ \hline
0.9988 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 \\ \hline
0.9952 & 1 & 0 &  0 &  0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 \\ \hline
0.9892 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 &  1 &  0 &  0 &  1 \\ \hline
0.9808 & 1 & 0 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  0 \\ \hline
0.9697 & 1 & 0 &  0 &  0 &  0 & -1 &  0 &  0 &  0 &  0 &  1 &  0 \\ \hline
0.9569 & 1 & 0 &  0 &  0 & -1 &  0 &  1 &  0 &  1 &  0 &  0 & -1 \\ \hline
0.9415 & 1 & 0 &  0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 &  0 \\ \hline
0.9239 & 1 & 0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 &  1 &  0 &  0 \\ \hline
0.9040 & 1 & 0 &  0 & -1 &  0 &  1 &  0 &  0 &  0 & -1 &  0 & -1 \\ \hline
0.8819 & 1 & 0 &  0 & -1 &  0 &  0 &  0 &  1 &  0 &  0 & -1 &  0 \\ \hline
0.8577 & 1 & 0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 & -1 &  0 &  0 \\ \hline
0.8315 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 & -1 &  0 \\ \hline
0.8032 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  0 \\ \hline
0.7730 & 1 & 0 & -1 &  0 &  0 &  1 &  0 & -1 &  0 &  0 &  0 &  1 \\ \hline
0.7410 & 1 & 0 & -1 &  0 &  0 &  0 &  0 & -1 &  0 & -1 &  0 &  1 \\ \hline
0.7071 & 1 & 0 & -1 &  0 &  0 &  0 &  1 &  0 &  1 &  0 &  0 &  0 \\ \hline
\end{tabular}

\end{table}

\end{document}

根据文档中的文本宽度,可能不需要对 进行小幅调整\tabcolsep。如果边距不够宽,最好使用\small

在此处输入图片描述

答案4

参考@Rmano 的建议

在此处输入图片描述

平均能量损失

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{nicematrix, xcolor}

\usepackage{booktabs}

\begin{document}
    \begin{NiceTabular}{ *{13}{c} }
        \CodeBefore
        \rowcolor{gray!50}{1}
        \rowcolors{2}{gray!25}{white}
        \Body
        \toprule
\Block[fill=white]{2-1}{Constant Value \\of the real part}                                                                                  &\Block{1-12}{Binary representation of real part} &&&&&&&&&&&\\ 
& 20 & 2-1 & 2-2 & 2-3 & 2-4 & 2-5 & 2-6 & 2-7 & 2-8 & 2-9 & 2-10 & 2-11 \\ 
        \midrule
        0.9988 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 \\ 
        0.9952 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 \\ 
        0.9892 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 1 \\ 
        0.9808 & 1 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 0 \\ 
        0.9697 & 1 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 1 & 0 \\ 
        0.9569 & 1 & 0 & 0 & 0 & -1 & 0 & 1 & 0 & 1 & 0 & 0 & -1 \\ 
        0.9415 & 1 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 
        0.9239 & 1 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 & 1 & 0 & 0 \\ 
        0.9040 & 1 & 0 & 0 & -1 & 0 & 1 & 0 & 0 & 0 & -1 & 0 & -1 \\ 
        0.8819 & 1 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & -1 & 0 \\ 
        0.8577 & 1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 \\ 
        0.8315 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & -1 & 0 \\ 
        0.8032 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 0 \\ 
        0.7730 & 1 & 0 & -1 & 0 & 0 & 1 & 0 & -1 & 0 & 0 & 0 & 1 \\ 
        0.7410 & 1 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 & 1 \\ 
        0.7071 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\ 
        \bottomrule
        
    \end{NiceTabular}
    
\end{document}

相关内容