1

I am using the template from the below link

https://digital-library.theiet.org/files/IET_Author-doublecolumn-submission.zip

The code for constructing the table is

\documentclass{cta-author}
\usepackage{multirow}
\usepackage{booktabs}
 \begin{document}
 \begin{table}[]
    \centering
    \processtable{Comparison of performance indices for different cases \label{Table2}}
    {\begin{tabular}{@{\extracolsep{\fill}}|c|c|c|c|c|@{}}
            \toprule 
             &  A             & B              & C               & \multicolumn{1}{c|}{}     \\ 
            \midrule
            \multirow{3}{*}{p = 2}                                             & 0.5               & 
            0.01               & 0.29               & \multicolumn{1}{c|}{I}  \\ \cmidrule{2-5} 
            & 0.56                 & 4.7                 & 2.7                 & \multicolumn{1}{c|} 
           {J}  \\ \cmidrule{2-5} 
            & 8.2                  & 2.6                 & 1.4                 & \multicolumn{1}{c|} 
       {K} \\ 
            \bottomrule
    \end{tabular}}{}
    \end{table}

    \end{document}

Table

I want complete single vertical lines for all the columns. In the table image attached here, the vertical lines of the columns are broken in each row. What changes shall I make in the code to ensure a single vertical line in the columns?

6
  • 1
    booktabs with commands like \midrule is not made for vertical rules.
    – user194703
    Commented May 11, 2020 at 3:47
  • What shall I use in place of \midrule, \cmidrule, \bottomrule
    – ShJ
    Commented May 11, 2020 at 4:00
  • 2
    (1) change all the horizontal rules by \hline or (2) very very very much better, remove all the vertical lines and left "as is" the booktabs rules.
    – Fran
    Commented May 11, 2020 at 4:00
  • I have replaced \midrule by \hline. How shall I replace \cmidrule{2-5}?
    – ShJ
    Commented May 11, 2020 at 4:13
  • 2
    @ShiS - How about \cline{2-5}. Do also please check out What are good learning resources for a LaTeX beginner?
    – Mico
    Commented May 11, 2020 at 4:55

1 Answer 1

2

Here's a solution that (a) gets rid of all vertical lines, thereby giving the table a much more open "look", (b) gets rid of code clutter, such as the meaning \multicolumn wrappers around the cells in the final column, and replaces the mistaken @{\extracolsep{\fill}} directive with @{} since a tabular rather than a tabular* environment is in use.

A general comment: Just because one can find lots of LaTeX code out there on the Internet doesn't mean that the code is of high quality or, more modestly, bug-free.

enter image description here

\documentclass{article}
% \usepackage{multirow} % not needed
\usepackage{booktabs}
\begin{document}
\begin{table}
  \centering
  % (don't know how '\processtable' is defined, hence commented out:)
  % \processtable{Comparison of performance indices for different cases}
  \label{Table2}
    \begin{tabular}{@{} l cccc @{}}     \toprule 
             &  A   & B    & C    & D \\ \midrule
             & 0.5  & 0.01 & 0.29 & I \\ \cmidrule{2-5} 
       p = 2 & 0.56 & 4.7  & 2.7  & J \\ \cmidrule{2-5} 
             & 8.2  & 2.6  & 1.4  & K \\ \bottomrule
    \end{tabular}
 \end{table}
 \end{document}
2
  • Is it possible to add 3 vertical lines: at the leftmost end of the table, rightmost end of the table and at the beginning of the second column (after p = 2)? However, the command \cline{2-5} cannot be used in the template given in question
    – ShJ
    Commented May 11, 2020 at 6:00
  • 1
    @Mico +1 for excellent edit-- my education increased
    – js bibra
    Commented May 11, 2020 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .