I've got a slight problem with my longtable using the IEEEtran article class.
I'm using something close to this MWE, the original one is 4-pages longer than this, and the MWE captures the problem. The \specialcell{} comes from this answer in the source below.
\documentclass[journal]{IEEEtran}
\usepackage{longtable,booktabs,multirow,lipsum,array}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\title{A MWE with a longtable cell width problem}
\author{Joao Andrade}
\begin{document}
\maketitle
{\footnotesize\onecolumn
\begin{longtable}{c | cr | r | crrcc | c | c | rrr | c}
\caption{Summary of stuff.}
\label{tab:big_table_over_margins}\\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
%\cline{2-15}
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Lat.\\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ \textit{\centering Continued from previous page}} \\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Latency \\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endhead
\midrule \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\endlastfoot
\multirow{5}{*}{Work 1} & \multirow{5}{*}{{bpc}} & \multirow{3}{*}{512} & \multirow{5}{*}{6--8} & \multirow{5}{*}{802.16e} & \multirow{5}{*}{2} & 768 & \multirow{5}{*}{1/2} & \multirow{5}{*}{Struct.} & \multirow{5}{*}{TDMP} & \multirow{5}{*}{MSA} & 2.62 & 150 & \multirow{5}{*}{10} & \multirow{5}{*}{\specialcell{GeForce\\9800 GTX+}}\tabularnewline
& & & & & & 1152 & & & & & 3.88 & 152 & & \tabularnewline
& & & & & & 1536 & & & & & 4.91 & 160 & & \tabularnewline
& & 384 & & & & 1920 & & & & & 5.27 & 140 & & \tabularnewline
& & 256 & & & & 2304 & & & & & 3.69 & 160 & & \tabularnewline
Work 2 & {cpc} & 128 & 8 & 802.16e & 2 & 2304 & 1/2 & Struct. & TDMP & MSA & 1.09 & 270 & 10 & \specialcell{Cell\\B.E.}\tabularnewline
\hline
\multirow{4}{*}{Work 3} & \multirow{4}{*}{{tpn}} & \multirow{4}{*}{1} & \multirow{4}{*}{8} & \multirow{4}{*}{802.16e} & & 768 & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{MSA} & 0.01 & 98.7 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & 1152 & & & & & 0.01 & 103.9 & & \tabularnewline
& & & & & & 1536 & & & & & 0.02 & 81.4 & & \tabularnewline
& & & & & & 1920 & & & & & 0.02 & 81.0 & & \tabularnewline
\multirow{4}{*}{Work 4} & \multirow{4}{*}{bpe} & \multirow{4}{*}{4} & \multirow{4}{*}{32} & \multirow{4}{*}{Regular} & 32 & \multirow{4}{*}{384} & \multirow{4}{*}{1/3} & \multirow{4}{*}{Sparse} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{\specialcell{FFT-\\-SPA}} & 14.93 & 0.82 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Tesla\\C1060}}\tabularnewline
& & & & & 64 & & & & & & 31.55 & 0.39 & & \tabularnewline
& & & & & 128 & & & & & & 7.36 & 1.67 & & \tabularnewline
& & & & & 256 & & & & & & 10.28 & 1.20 & & \tabularnewline
\hline
\multirow{6}{*}{Work 5} & \multirow{2}{*}{{tpn}} & \multirow{6}{*}{1} & \multirow{6}{*}{8} & \multirow{2}{*}{802.11n} & \multirow{6}{*}{2} & \multirow{2}{*}{1944} & \multirow{2}{*}{1/2} & \multirow{2}{*}{Struct.} & \multirow{2}{*}{TPMP} & \multirow{2}{*}{MSA} & 0.12 & 16 & \multirow{6}{*}{10} & \multirow{2}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & & & & & & 0.09 & 21 & & \tabularnewline
& \multirow{4}{*}{N/A} & & & \multirow{4}{*}{DVB-S2} & & \multirow{4}{*}{64800} & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{\specialcell{TPMP\\TDMP}} & \multirow{4}{*}{MSA} & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex5 LX330T\\Max2 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1260 & & \tabularnewline
& & & & & & & & & & & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex6 LX330T\\Max3 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1296 & & \tabularnewline
\bottomrule
\end{longtable}
\lipsum[1]
{\footnotesize\onecolumn
\begin{longtable}{@{}c@{} | @{}c@{}@{}r@{} | @{}r@{} | @{}c@{}@{}r@{}@{}r@{}@{}c@{}@{}c@{} | @{}c@{} | @{}c@{} | @{}r@{}@{}r@{}@{}r@{} | @{}c@{}}
\caption{Summary of stuff.}
\label{tab:big_table_nospace}\\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
%\cline{2-15}
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Lat.\\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ \textit{\centering Continued from previous page}} \\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Latency \\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endhead
\midrule \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\endlastfoot
\multirow{5}{*}{Work 1} & \multirow{5}{*}{{bpc}} & \multirow{3}{*}{512} & \multirow{5}{*}{6--8} & \multirow{5}{*}{802.16e} & \multirow{5}{*}{2} & 768 & \multirow{5}{*}{1/2} & \multirow{5}{*}{Struct.} & \multirow{5}{*}{TDMP} & \multirow{5}{*}{MSA} & 2.62 & 150 & \multirow{5}{*}{10} & \multirow{5}{*}{\specialcell{GeForce\\9800 GTX+}}\tabularnewline
& & & & & & 1152 & & & & & 3.88 & 152 & & \tabularnewline
& & & & & & 1536 & & & & & 4.91 & 160 & & \tabularnewline
& & 384 & & & & 1920 & & & & & 5.27 & 140 & & \tabularnewline
& & 256 & & & & 2304 & & & & & 3.69 & 160 & & \tabularnewline
Work 2 & {cpc} & 128 & 8 & 802.16e & 2 & 2304 & 1/2 & Struct. & TDMP & MSA & 1.09 & 270 & 10 & \specialcell{Cell\\B.E.}\tabularnewline
\hline
\multirow{4}{*}{Work 3} & \multirow{4}{*}{{tpn}} & \multirow{4}{*}{1} & \multirow{4}{*}{8} & \multirow{4}{*}{802.16e} & & 768 & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{MSA} & 0.01 & 98.7 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & 1152 & & & & & 0.01 & 103.9 & & \tabularnewline
& & & & & & 1536 & & & & & 0.02 & 81.4 & & \tabularnewline
& & & & & & 1920 & & & & & 0.02 & 81.0 & & \tabularnewline
\multirow{4}{*}{Work 4} & \multirow{4}{*}{bpe} & \multirow{4}{*}{4} & \multirow{4}{*}{32} & \multirow{4}{*}{Regular} & 32 & \multirow{4}{*}{384} & \multirow{4}{*}{1/3} & \multirow{4}{*}{Sparse} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{\specialcell{FFT-\\-SPA}} & 14.93 & 0.82 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Tesla\\C1060}}\tabularnewline
& & & & & 64 & & & & & & 31.55 & 0.39 & & \tabularnewline
& & & & & 128 & & & & & & 7.36 & 1.67 & & \tabularnewline
& & & & & 256 & & & & & & 10.28 & 1.20 & & \tabularnewline
\hline
\multirow{6}{*}{Work 5} & \multirow{2}{*}{{tpn}} & \multirow{6}{*}{1} & \multirow{6}{*}{8} & \multirow{2}{*}{802.11n} & \multirow{6}{*}{2} & \multirow{2}{*}{1944} & \multirow{2}{*}{1/2} & \multirow{2}{*}{Struct.} & \multirow{2}{*}{TPMP} & \multirow{2}{*}{MSA} & 0.12 & 16 & \multirow{6}{*}{10} & \multirow{2}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & & & & & & 0.09 & 21 & & \tabularnewline
& \multirow{4}{*}{N/A} & & & \multirow{4}{*}{DVB-S2} & & \multirow{4}{*}{64800} & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{\specialcell{TPMP\\TDMP}} & \multirow{4}{*}{MSA} & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex5 LX330T\\Max2 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1260 & & \tabularnewline
& & & & & & & & & & & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex6 LX330T\\Max3 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1296 & & \tabularnewline
\bottomrule
\end{longtable}
\lipsum[1]
{\footnotesize\onecolumn
\begin{longtable}{@{ }c@{ } | @{ }c@{ }@{ }r@{ } | @{ }r@{ } | @{ }c@{ }@{ }r@{ }@{ }r@{ }@{ }c@{ }@{ }c@{ } | @{ }c@{ } | @{ }c@{ } | @{ }r@{ }@{ }r@{ }@{ }r@{ } | @{ }c@{ }}
\caption{Summary of stuff.}
\label{tab:big_table_somespace}\\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
%\cline{2-15}
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Lat.\\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ \textit{\centering Continued from previous page}} \\
\multirow{1}{*}{Work} & \multicolumn{2}{c|}{Parallelism} & \multicolumn{1}{c|}{Data} & \multicolumn{5}{c|}{LDPC Code} & \multicolumn{2}{c|}{Decoding} & \multicolumn{3}{c|}{Perf.} & \multicolumn{1}{c}{Platform}\tabularnewline\midrule
& Thread- & Data- & \multicolumn{1}{c|}{Width} & \multicolumn{1}{c}{Code} & q & N & Rate & Tanner & Sched. & Alg. & \specialcell{Latency \\(ms)} & \specialcell{Thr.\\(Mbit/s)} & Iter. & Name\tabularnewline
\midrule
\endhead
\midrule \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\endlastfoot
\multirow{5}{*}{Work 1} & \multirow{5}{*}{{bpc}} & \multirow{3}{*}{512} & \multirow{5}{*}{6--8} & \multirow{5}{*}{802.16e} & \multirow{5}{*}{2} & 768 & \multirow{5}{*}{1/2} & \multirow{5}{*}{Struct.} & \multirow{5}{*}{TDMP} & \multirow{5}{*}{MSA} & 2.62 & 150 & \multirow{5}{*}{10} & \multirow{5}{*}{\specialcell{GeForce\\9800 GTX+}}\tabularnewline
& & & & & & 1152 & & & & & 3.88 & 152 & & \tabularnewline
& & & & & & 1536 & & & & & 4.91 & 160 & & \tabularnewline
& & 384 & & & & 1920 & & & & & 5.27 & 140 & & \tabularnewline
& & 256 & & & & 2304 & & & & & 3.69 & 160 & & \tabularnewline
Work 2 & {cpc} & 128 & 8 & 802.16e & 2 & 2304 & 1/2 & Struct. & TDMP & MSA & 1.09 & 270 & 10 & \specialcell{Cell\\B.E.}\tabularnewline
\hline
\multirow{4}{*}{Work 3} & \multirow{4}{*}{{tpn}} & \multirow{4}{*}{1} & \multirow{4}{*}{8} & \multirow{4}{*}{802.16e} & & 768 & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{MSA} & 0.01 & 98.7 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & 1152 & & & & & 0.01 & 103.9 & & \tabularnewline
& & & & & & 1536 & & & & & 0.02 & 81.4 & & \tabularnewline
& & & & & & 1920 & & & & & 0.02 & 81.0 & & \tabularnewline
\multirow{4}{*}{Work 4} & \multirow{4}{*}{bpe} & \multirow{4}{*}{4} & \multirow{4}{*}{32} & \multirow{4}{*}{Regular} & 32 & \multirow{4}{*}{384} & \multirow{4}{*}{1/3} & \multirow{4}{*}{Sparse} & \multirow{4}{*}{TPMP} & \multirow{4}{*}{\specialcell{FFT-\\-SPA}} & 14.93 & 0.82 & \multirow{4}{*}{10} & \multirow{4}{*}{\specialcell{Tesla\\C1060}}\tabularnewline
& & & & & 64 & & & & & & 31.55 & 0.39 & & \tabularnewline
& & & & & 128 & & & & & & 7.36 & 1.67 & & \tabularnewline
& & & & & 256 & & & & & & 10.28 & 1.20 & & \tabularnewline
\hline
\multirow{6}{*}{Work 5} & \multirow{2}{*}{{tpn}} & \multirow{6}{*}{1} & \multirow{6}{*}{8} & \multirow{2}{*}{802.11n} & \multirow{6}{*}{2} & \multirow{2}{*}{1944} & \multirow{2}{*}{1/2} & \multirow{2}{*}{Struct.} & \multirow{2}{*}{TPMP} & \multirow{2}{*}{MSA} & 0.12 & 16 & \multirow{6}{*}{10} & \multirow{2}{*}{\specialcell{Nallatech\\PCI 385N D5}}\tabularnewline
& & & & & & & & & & & 0.09 & 21 & & \tabularnewline
& \multirow{4}{*}{N/A} & & & \multirow{4}{*}{DVB-S2} & & \multirow{4}{*}{64800} & \multirow{4}{*}{1/2} & \multirow{4}{*}{Struct.} & \multirow{4}{*}{\specialcell{TPMP\\TDMP}} & \multirow{4}{*}{MSA} & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex5 LX330T\\Max2 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1260 & & \tabularnewline
& & & & & & & & & & & 0.28 & 234 & & \multirow{2}{*}{\specialcell{Virtex6 LX330T\\Max3 Board}}\tabularnewline
& & & & & & & & & & & 0.05 & 1296 & & \tabularnewline
\bottomrule
\end{longtable}
\lipsum[1]
\end{document}
The original paper comes in two-column, but margins remain the same under onecolumn so \lipsum[1] suffices to mark the limits to the longtable width.
The first table clearly outspans the margins . So I changed the spacing between text in each cell to @{} in \ref{tab:big_table_nospace}. The result stays within the margins with a problem
. The fourth column is too wide for what it's supposed to be.
Making @{} to be @{ } in \ref{tab:big_table_some_space} sees similar issue. The fourth column is too wide.
How does one solve this? It is clear that the table is one the brink of fitting to the margins. However, even with manually adjustment of the cells as p{.##cm} makes the fourth column to grow to be too wide. What am I missing here?
tabcolsep
to4pt
by\setlength{\tabcolsep}{4pt}
. After than table will fit to width of text. However, to my test your table will still looks ugly. – Zarko Oct 7 '15 at 17:43