1

I have 8 columns in my table and everything fits perfectly except the very last value, which is about 5 columns long/wide (it's a very long binary string) and it's on the last row all by itself, I want it to be aligned like all the other values in the first column and just trail off, but tabular is pushing the second column all the way to the end of this one long string. It's understandable, it's just doing what it's programmed to do, but can I tell tabular to ignore how long this last value is so it can pass freely through all the columns without disrupting them?

\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}

enter image description here

voices
  • 2,039
  • So you want to have it in multiple columns? –  May 20 '19 at 16:51
  • @JouleV I want the columns to behave almost as if this super long value wasn't even there. See how all the rows have a huge gap there now before the second column starts, because the first column is stretched? – voices May 20 '19 at 16:58
  • So you want to set the maximum width of each column? Or make the widths fixed? –  May 20 '19 at 16:58
  • Use \multicolumn{7}{l}{\ttfamily 011100111000100101111100001111010111....} – Ulrike Fischer May 20 '19 at 17:00
  • @JouleV well.. neither really, but I suppose either way would be a close enough workaround in this instance. Seems like every LaTeX table I make, there's at least one outlier that I need to break the rules I set based on the most common denominators. Would be good if there was a way I could just break or bypass the rules or change the expected number of cells/columns per row, or merge specific cells, etc. – voices May 20 '19 at 17:15
  • 1
    you can merge cells, see the multicolumn use in the comment above. (I think in 30 something years of tex use that's the first time I have seen \verb delimited by spaces;-) – David Carlisle May 20 '19 at 17:23
  • @DavidCarlisle I think it's actually delimited by the & used for alignment. At first I thought it was the spaces too, but it seems not. It was accidental either way, I originally used + as the delimiter, but it was being rendered. I removed the delimiter and it worked like a charm. – voices May 20 '19 at 17:36
  • @tjt263 no it is space delimited, (but why are you using verb at all? there are no tex commands here that need to be disabled) – David Carlisle May 20 '19 at 17:37
  • @DavidCarlisle I think you'll find it's not. I ran a few tests on it. Either way, I just used verbatim to format some code blocks. I wanted the same fixed width style and it was quick and painless compared to other things I tried. – voices May 20 '19 at 17:47
  • It is space delimited, try omitting the space after \verb s and you will see the verb extends past the & which no longer ends the the cell, you do not want \verb at all here just a font change so \ttfamily to get monospace. – David Carlisle May 20 '19 at 17:52

1 Answers1

3

You seem to be looking for \multicolumn but also should not be using \verb here.

enter image description here

\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}
David Carlisle
  • 757,742