2

I am having a hard time trying to fit a table in my 2 column latex paper.


    \documentclass[nocrop]{bioinfo}

     \usepackage[english]{babel}

    \usepackage{dsfont}
    \usepackage{natbib}
    \usepackage{tabularx}
     \bibliographystyle{natbib.bst}
    \copyrightyear{2020} \pubyear{2020}
     \access{Advance Access Publication Date: Day Month Year}
    \appnotes{Manuscript Category}

    \begin{document}
\begin{table}[!b]
\centering
\processtable{Precision, Recall and Accuracy of graphs elucidated with BIC score, $Score_{LOPC}$ and $Score_{LASSO}$. Search method: greedy hill-climbing search \label{Tab:02}} {\begin{tabularx}{\columnwidth}{@{}lllllll@{}}

\toprule Score & $\gamma$& Max parents & Precision  & Recall & SHD  & BAC\\\midrule

BIC             & -     & 3 & 0.4626 & 0.5212 & 135.52  & 0.7446 \\

$Score_{LOPC}$  & 0.6   & 3 & \textbf{0.5162} & 0.5242 & \textbf{120.89} & \textbf{0.7491} \\

$Score_{LASSO}$ & 0.6   & 3 & \textbf{0.5042} & 0.5328 & \textbf{123.9} & \textbf{0.7526} \\
\midrule
BIC         & -     & Inf & 0.1608 & \textbf{0.6954} & 504.77  & 0.7494 \\

$Score_{LOPC}$  & 0.6 & Inf & \textbf{0.2024} & 0.6733 & \textbf{379.93} & \textbf{0.7652} \\
$Score_{LASSO}$ & 0.6   & Inf & \textbf{0.1758} & 0.6929 & \textbf{456.13} & \textbf{0.7585} \\
\botrule
\end{tabularx}}{}
\end{table}


\begin{table}%[!ht]
\processtable{Total number and percentage of experimentally verified arcs found using BN structure learning with BIC, $Score_{LOPC}$ and $Score_{LASSO}$. Search Method: Greedy hill-climbing search \label{Tab:03}} {\begin{tabularx}{\columnwidth}{@{}p{2cm}p{0.5cm}p{1cm}p{2cm}p{2cm}@{}}  
\toprule Score & $\gamma$ & Total arcs & $\%$ of experimentally verified arcs & No. of experimentally verified arcs \\\midrule
BIC      & -    & 7742 & 19.32 & 1496 \\
$Score_{LOPC}$ & 0.0 & 1276 & 18.02 & 230  \\
$Score_{LOPC}$ & 0.2 & 1788 & 18.51 & 331 \\
\midrule
$Score_{LASSO}$ & 0.0 & 1355 & 20.22 & 274  \\
$Score_{LASSO}$ & 0.2 & 1374 & 20.08 & 376 \\
\botrule
\end{tabularx}}{}
\end{table}

It is hard to make a MWE because it happens what i compile the entire paper, not when i only have the tables in my work. The column next to the table goes blankenter image description here

5
  • It might be easier to align horizontally both tables.
    – Bernard
    May 28, 2020 at 15:30
  • @Bernard how do i do that? May 28, 2020 at 15:37
  • You have the strip environment from the cuted package (sttools bundle), used with floatrow. Do you need a caption?
    – Bernard
    May 28, 2020 at 15:44
  • These are two separate tables with separate captions May 28, 2020 at 15:55
  • That's no problem with floatrrow. If you do not need to have the side by side, you can use \InsertBoxC, from the insbox plain TeX macro package.
    – Bernard
    May 28, 2020 at 16:11

1 Answer 1

2

In the case of the first table, I wouldn't use a tabularx environment as no line breaks within cells are needed; I'd use a tabular* environment instead. In the case of the second table, you're not using the tabularx environment properly as none of the columns are of type X.

enter image description here

\documentclass[nocrop]{bioinfo}
\usepackage[english]{babel}
\usepackage{amsmath,tabularx,ragged2e,lipsum,microtype}
\newcolumntype{C}{>{\Centering}X}
\newcommand\vn[1]{\textrm{#1}} % how to display variable names
\begin{document}
\begin{table}[ht!]
\setlength{\tabcolsep}{0pt}
\processtable{Precision, Recall and Accuracy of graphs elucidated with BIC score, $\vn{Score}_{\vn{LOPC}}$ and $\vn{Score}_{\vn{LASSO}}$. Search method: Greedy hill-climbing search.\label{Tab:02}}%
{\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}l *{6}{c}}
\toprule 
Score & $\gamma$ & Max parents & Precision & Recall & SHD  & BAC\\
\midrule
BIC             & --     & 3 & 0.4626 & 0.5212 & 135.52  & 0.7446 \\
$\vn{Score}_{\vn{LOPC}}$  & 0.6   & 3 & \textbf{0.5162} & 0.5242 & \textbf{120.89} & \textbf{0.7491} \\
$\vn{Score}_{\vn{LASSO}}$ & 0.6   & 3 & \textbf{0.5042} & 0.5328 & \textbf{123.9\phantom{0}} & \textbf{0.7526} \\
\midrule
BIC         & --     & Inf & 0.1608 & \textbf{0.6954} & 504.77  & 0.7494 \\
$\vn{Score}_{\vn{LOPC}}$  & 0.6 & Inf & \textbf{0.2024} & 0.6733 & \textbf{379.93} & \textbf{0.7652} \\
$\vn{Score}_{\vn{LASSO}}$ & 0.6   & Inf & \textbf{0.1758} & 0.6929 & \textbf{456.13} & \textbf{0.7585} \\
\botrule
\end{tabular*}}{}
\end{table}

\begin{table}[!h]
\processtable{Total number and percentage of experimentally verified arcs found using BN structure learning with BIC, $\vn{Score}_{\vn{LOPC}}$ and $\vn{Score}_{\vn{LASSO}}$. Search method: Greedy hill-climbing search.\label{Tab:03}}% 
{\begin{tabularx}{\columnwidth}{@{}lccCC@{}}  
\toprule 
Score & $\gamma$ & Total arcs & $\%$ of experimentally verified arcs & No. of experimentally verified arcs \\
\midrule
BIC      & --    & 7742 & 19.32 & 1496 \\
$\vn{Score}_{\vn{LOPC}}$ & 0.0 & 1276 & 18.02 & 230 \\
$\vn{Score}_{\vn{LOPC}}$ & 0.2 & 1788 & 18.51 & 331 \\
\midrule
$\vn{Score}_{\vn{LASSO}}$ & 0.0 & 1355 & 20.22 & 274 \\
$\vn{Score}_{\vn{LASSO}}$ & 0.2 & 1374 & 20.08 & 376 \\
\botrule
\end{tabularx}}{}
\end{table}

\lipsum[1-10] % generate some filler text
\end{document}

Addendum to address the OP's follow-up query. The amount of whitespace between the two floats and between the lower float and the text does seem to be quite excessive, doesn't it? The bioinfo document class provides the following definitions for the parameters \floatsep, \textfloatsep, and \intextsep.

% Space between floats
\setlength\floatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
% Space between floats and text
\setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
% Space above and below an inline figure
\setlength\intextsep   {18\p@ \@plus 2\p@ \@minus 2\p@}

Try inserting the following instructions in the preamble

\setlength\floatsep    {6pt plus 2pt minus 2pt}
\setlength\textfloatsep{6pt plus 2pt minus 2pt}
\setlength\intextsep   {6pt plus 2pt minus 2pt}

and check if the result is more pleasing.

4
  • 1
    Thank you it work. Can you also suggest how to get rid of extra space under the tables May 28, 2020 at 17:21
  • @HamdaBinteAjmal - Please see the addendum I just posted.
    – Mico
    May 28, 2020 at 17:52
  • You could put both tabulars and captions into one table. It is curious that the next paragraph breaks after 2 lines. May 28, 2020 at 22:49
  • @JohnKormylo - My apologies for the false impression created by the screenshot: The left-hand column actually continues on for many more lines. I'll post a new, hopefully less misleading, screenshot shortly. About placing both tabulars and their captions in a single table environment: I thought about that but didn't as the OP's write-up indicated to me that separate table environments should be employed. However, I may have been wrong.
    – Mico
    May 29, 2020 at 4:33

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.