1

I've got a two-column article and I'm trying to make a long table which cannot fit into a single column. The only trouble I'm having in overriding the formatting seems to be that the lines containing the table won't extend to the end.

When I run LaTeX, I'm told:

Overfull \hbox (127.68214pt too wide) in alignment at lines 44--51

[] [] [] [] [] [] [] [] [] []

Here's what the code looks like:

\documentclass[twocol]{ametsoc}

...

\begin{table}
\caption{Arctic radiative fluxes under standard conditions.}
\begin{tabular*}{\hsize}{@{\extracolsep\fill}|l|ccccccccc|@{}}
\topline
Height& SW$_{up}$& SW$_{down}$& SW$_{net}$& LW$_{up}$& LW$_{down}$& LW$_{net}$& Net Up& Net Down& Net Flux\\
\midline
\ TOA& 57.7& 144.1& -86.4& 171.0& \phantom{1}\phantom{1}0.0& 171.0& 228.7& 144.1& 84.6\\
\ SFC& 21.1& \phantom{1}81.6& -60.6& 194.2& 134.6& \phantom{1}59.7& 215.3& 216.2& -0.9\\
\botline
\end{tabular*}
\end{table}

enter image description here

  • 1
    Welcome to TeX. SE!. Please expend your code sniped to complete document, which has all to table related package! Help us to help you. – Zarko Mar 24 '17 at 22:33
  • 1
    You should use table* and not table; also \hsize should be \textwidth. – egreg Mar 24 '17 at 22:38
  • 1
    Your table is to wide for fit in one column only. Consider @egreg comment. – Zarko Mar 24 '17 at 22:45
3

Since the tabular material is wider than a single column, you need to use a combination of table* and tabular environments, not a combination of table and tabular*. Do also use a column type, such as S (provided by the siunitx package), that facilitates typesetting negative numbers and aligning numbers on their decimal markers. And do use \textsubscript rather than math mode to typeset text in subscript positions.

enter image description here

\documentclass[twocol]{ametsoc}
\usepackage{siunitx} % for "S" column type
\begin{document}
\begin{table*}
\centering
\caption{Arctic radiative fluxes under standard conditions.}
\begin{tabular}{|c|*{9}{S[table-format=3.1]}|@{}}
\topline
Height& {SW\textsubscript{up}} & {SW\textsubscript{down}} & {SW\textsubscript{net}} 
      & {LW\textsubscript{up}} & {LW\textsubscript{down}} & {LW\textsubscript{net}} 
      & {Net Up} & {Net Down} & {Net Flux} \\
\midline
TOA& 57.7& 144.1& -86.4& 171.0& 0.0& 171.0& 228.7& 144.1& 84.6\\
SFC& 21.1& 81.6& -60.6& 194.2& 134.6& 59.7& 215.3& 216.2& -0.9\\
\botline
\end{tabular}
\end{table*}

\end{document}

Addendum: In case it's important to typeset the tabular material so that it spans the full width of both columns, you could use either a tabular* or a tabularx environment, with the width set to \textwidth. (\hsize is a low-level TeX macro which should, with a few exceptions, not be invoked directly.) The following screenshot contrasts the looks of the tabular, tabular*, and tabularx-based solutions. Observe that the setup of the third, tabularx-based solution is a bit of a hybrid: the main column type for the nine data columns is S, but the nine header cells are typeset using a centered version of the X column type.

enter image description here

\documentclass[twocol]{ametsoc}
\usepackage{siunitx} % for "S" column type
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand\mc[1]{\multicolumn{1}{C}{#1}}
\begin{document}
\begin{table*}
\centering

\caption{Using a \texttt{tabular} environment}
\begin{tabular}{|c| S[table-format=2.1] *{8}{S[table-format=3.1]}|@{}}
\topline
Height& {SW\textsubscript{up}} & {SW\textsubscript{down}} & {SW\textsubscript{net}} 
      & {LW\textsubscript{up}} & {LW\textsubscript{down}} & {LW\textsubscript{net}} 
      & {Net Up} & {Net Down} & {Net Flux} \\
\midline
TOA& 57.7& 144.1& -86.4& 171.0& 0.0& 171.0& 228.7& 144.1& 84.6\\
SFC& 21.1& 81.6& -60.6& 194.2& 134.6& 59.7& 215.3& 216.2& -0.9\\
\botline
\end{tabular}

\bigskip
\caption{Using a \texttt{tabular*} environment}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}|c| 
           S[table-format=2.1] *{8}{S[table-format=3.1]}|@{}}
\topline
Height& {SW\textsubscript{up}} & {SW\textsubscript{down}} & {SW\textsubscript{net}} 
      & {LW\textsubscript{up}} & {LW\textsubscript{down}} & {LW\textsubscript{net}} 
      & {Net Up} & {Net Down} & {Net Flux} \\
\midline
TOA& 57.7& 144.1& -86.4& 171.0& 0.0& 171.0& 228.7& 144.1& 84.6\\
SFC& 21.1& 81.6& -60.6& 194.2& 134.6& 59.7& 215.3& 216.2& -0.9\\
\botline
\end{tabular*}

\bigskip
\setlength\tabcolsep{3pt}
\caption{Using a \texttt{tabularx} environment}
\begin{tabularx}{\textwidth}{|C| 
           S[table-format=2.1] *{8}{S[table-format=3.1]}|@{}}
\topline
Height& \mc{SW\textsubscript{up}} & \mc{SW\textsubscript{down}} & \mc{SW\textsubscript{net}} 
      & \mc{LW\textsubscript{up}} & \mc{LW\textsubscript{down}} & \mc{LW\textsubscript{net}} 
      & \mc{Net Up} & \mc{Net Down} & \multicolumn{1}{C|}{Net Flux} \\
\midline
TOA& 57.7& 144.1& -86.4& 171.0& 0.0& 171.0& 228.7& 144.1& 84.6\\
SFC& 21.1& 81.6& -60.6& 194.2& 134.6& 59.7& 215.3& 216.2& -0.9\\
\botline
\end{tabularx}
\end{table*}

\end{document}
  • you beat me (again) for few seconds :(. good solution! – Zarko Mar 24 '17 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.