1

I have a table that I use the following code to produce:

\begin{table}[h!]
\centering
\hline\noalign{\smallskip}
%\vspace{-0.3cm}
\caption{ \textit{The percentages of all three cases of paired-end read alignments by HMMER and Short-Pair for the RNA-Seq data. ``HMMER w/o filtration" : running HMMER by turning off all filtration steps. ``HMMER GA cutoff": applying HMMER with gathering thresholds.}}
\label{tab:ArabThreeCases2}
%\vspace{-0.3cm}
\begin{tabular}{lllllll}
\hline\noalign{\smallskip}
Case& A, & B,  & C, & D\\
 & $E$-value 10 & w/o filtration,  & GA cutoff &\\
  &  & $E$-value 10 & & \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
Case 1 &    34.51\% &   32.83\% &   22.51\% & 0.42\%\\
Case 2 &    28.42\% &   31.58\% &   8.84\%  & 62.51\%\\
Case 3 &    37.07\% &   35.59\% &   68.65\% & 37.07\%\\
\hline
\end{tabular}{}
\end{table}

The table created has an horizontal line before the table caption, which is what I want. But as you can see this horizontal line has a different length than the other horizontal lines in the table. I want all of them to have the same length (The length of the line above the caption). How would I achieve that? enter image description here

  • How many of such tables do you have? Is this something that is particular to this table, or does it have to apply to all tables? – Werner Mar 24 '17 at 18:13
  • It has to be applied to all tables. – fhcat Mar 24 '17 at 18:17
  • Do you want to shrink only the line or also the caption? – Marco Daniel Mar 24 '17 at 18:22
  • I don't want to shrink the line. I want to expand all other lines to make them same length as the line above the caption. – fhcat Mar 24 '17 at 18:23
  • 1
    BTW: You have declared 8 columns (of type l), but you are using only 5. And you can add extra space simply using \\[\smallskipamount] instead of \\\noalign{\smallskip} or better use booktabs. – Schweinebacke Mar 24 '17 at 18:49
1

Like this?

enter image description here

This table use combination of tabularx environment with S column typef for column with numbers:

\documentclass[12pt,a4paper,openright,oneside]{article}
\usepackage[font=small,
            labelfont=bf, 
            textfont=it,
            skip=1ex
            ]{caption}
\usepackage{booktabs, tabularx}
\newcommand\mc[1]{\multicolumn{1}{>{\centering\arraybackslash\hsize=1.1\hsize}X}{#1}}
\usepackage{siunitx}

\begin{document}

\begin{table}[h!]
    \centering
\hrule height 1pt\smallskip
\caption{The percentages of all three cases of paired-end read alignments by HMMER and Short-Pair for the RNA-Seq data. ``HMMER w/o filtration" : running HMMER by turning off all filtration steps. ``HMMER GA cutoff": applying HMMER with gathering thresholds.}
    \label{tab:ArabThreeCases2}
\begin{tabularx}{\linewidth}{>{\hsize=0.6\hsize}X
                                           *{4}{S[table-format=2.2,
                                                  table-space-text-post=\,\%]<{\,\%}}
                             }
    \toprule
Case    &   \mc{A,}         & \mc{B,}           & \mc{C,}           & \mc{D}    \cr
        & \mc{$E$-value 10} & \mc{w/o filtration\par 
                                  $E$-value 10} & \mc{GA cutoff}    & \mc{}     \cr
    \midrule

Case 1  &    34.51          &   32.83           &   22.51           & 0.42      \cr
Case 2  &    28.42          &   31.58           &   8.84            & 62.51     \cr
Case 3  &    37.07          &   35.59           &   68.65           & 37.07     \cr
    \bottomrule
\end{tabularx}
    \end{table}
\end{document}

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.