允许值绕过表格列对齐

允许值绕过表格列对齐

我的表格中有 8 列,除了最后一个值外,其余都完美匹配,最后一个值大约有 5 列长/宽(这是一个非常长的二进制字符串),并且单独位于最后一行,我希望它像第一列中的所有其他值一样对齐并逐渐变小,但 tabular 会将第二列一直推到这个长字符串的末尾。这可以理解,它只是在执行编程要做的事情,但我可以让 tabular 忽略最后一个值的长度,以便它可以自由地穿过所有列而不会破坏它们吗?

\documentclass[10pt]{article}
\usepackage{verbatim}

\begin{document}

\begin{table}[]
\begin{tabular}{l|llllllll}
\hline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\emph{utf-8}     & \verb s        & \verb          & \verb |        & \verb =        & \verb ~        & \verb w        & \verb          & \verb Ù        \\
\hline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\emph{hexadec}   & \verb 73       & \verb 89       & \verb 7C       & \verb 3D       & \verb 7E       & \verb 77       & \verb 87       & \verb D9       \\
\emph{decimal}   & \verb 115      & \verb 137      & \verb 124      & \verb 061      & \verb 126      & \verb 119      & \verb 135      & \verb 217      \\
\emph{binary}    & \verb 01110011 & \verb 10001001 & \verb 01111100 & \verb 00111101 & \verb 01111110 & \verb 01110111 & \verb 10000111 & \verb 11011001 \\
                 & \verb 0111001110001001011111000011110101111110011101111000011111011001 &                                                              \\
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

答案1

您似乎正在寻找\multicolumn但也不应该\verb在这里使用。

在此处输入图片描述

\documentclass[10pt]{article}
%\usepackage{verbatim}
\usepackage{array}
\begin{document}

\begin{table}% latex warns about an empty argument []
% use \ttfamily not space-delimited \verb
\hspace*{-61pt}\begin{tabular}{@{}l|*{8}{>{\ttfamily}l}@{}}
\hline
\emph{utf-8}     & s        &          & |        & =        & \verb|~|        & w        &          & Ù        \\
\hline 
\emph{hexadec}   & 73       & 89       & 7C       & 3D       & 7E       & 77       & 87       & D9       \\
\emph{decimal}   & 115      & 137      & 124      & 061      & 126      & 119      & 135      & 217      \\
\emph{binary}    & 01110011 & 10001001 & 01111100 & 00111101 & 01111110 & 01110111 & 10000111 & 11011001 \\
                 & \multicolumn{8}{l}{0111001110001001011111000011110101111110011101111000011111011001}  \\
\end{tabular}\hspace*{-61pt}
\end{table}
\end{document}

相关内容