1

I would like to add vertical lines in my table. Can anybody suggest me the change required in following code to get proper vertical lines in my table? Sample code is pasted below. Screenshot of the output is attached. Thanks a lot.

 \documentclass[sigconf, authordraft]{acmart}

\usepackage{booktabs}
\usepackage{multirow}
%
\begin{document}
\begin{table*}[!h]
\centering
\caption{Summary of Quantitative Evaluation}                                    
\label{tab:table3}
\begin{tabular}{|p{0.5 cm}|p{0.85 cm}|p{12 cm}|}
%\begin{tabular}{ccc}
\toprule
Sl.No. & Metric & Remark   \\
\midrule
1 & Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods.\\    
\bottomrule
2 & Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods.
\\
 \bottomrule
3& Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods. \\
 \bottomrule
 \end{tabular}
\end{table*}

\end{document} 

  • 5
    You are using booktabs package, see the package documentation it explains at great length how vertical rules in tables are evil and it makes them unusable by design. You need to choose to use that package or have vertical rules. – David Carlisle Aug 8 '18 at 7:58
1

To obtain intersecting vertical and horizontal lines with booktabs, you have to suppress the padding of booktabs rules. You can replace this padding with a minimal padding at the top and bottom of each cell in columns with specifier prefixed with the letter S, loading the cellspace package. Here is a possible code:

 \documentclass{article}
\usepackage{booktabs}
\usepackage{multirow, tabularx, caption, cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}
\addparagraphcolumntypes{X}
%
\begin{document}

\begin{table*}[!h]
\centering
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\setlength{\tabcolsep}{4pt}
\caption{Summary of Quantitative Evaluation}
\label{tab:table3}
\begin{tabularx}{\linewidth}{|l|l|S{X}|}
\toprule
Sl.No. & Metric & Remark \\
\midrule
1 & Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods.\\
\bottomrule
2 & Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods.
\\
 \bottomrule
3& Rel Bias & Smaller relative bias (almost equal to 0) is obtained for all fused bands and for all 7 fusion methods. \\
 \bottomrule
\end{tabularx}
 \end{table*}

\end{document} 

enter image description here

Note 1: If you load siunitx, which defines an S column type, you have to use another prefix; the default is C.

Note 2: Other than booktabs, some packages define horizontal lines with variable thickness: boldline (no paddding, but also defines variable width vertical lines) and makecell (which also lets you define a fixed padding for all cells of a table).

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.