1

Dear experienced friends, I met a question when I draw the table in LaTex. Suppose I want to draw a simple table as follows. We can see that the gaps between each line are evenly distributed. However, after I added the dividing line with \hline into the table, I found this dividing line is always closer to the row below.

May I ask is there any way that I can make the gap of rows evenly distributed again? To be more specific, I hope the heights between A->B,B->Dividing line,Dividing line->D,D->E become same. Can we achieve that?

Thank you so much in advance.

enter image description here

% Here is my code

\begin{table}[!htbp]
\centering
\begin{tabular}{l | l | p{5cm}}
\hline
 Name & ID & Description \\
\hline 
 $\mathit{A}$ & 1 & This is A \\
 $\mathit{B}$ & 2 & This is B \\
\hline
 $\mathbf{D}$ & 4 & This is D\\
 $\mathbf{E}$ & 5 & This is E\\
\hline
\end{tabular}
\end{table}

1 Answer 1

3

One possibility would be the booktabs package. One feature to know about, however, is that booktabs has strong opinions about how tables should look. One of those opinions is that you should never use vertical lines in a table. As such, vertical lines do not work well in tables with booktabs.

\documentclass{article}

\usepackage{booktabs}

\begin{document}
\begin{table}[!htbp]
\centering
\begin{tabular}{l l p{5cm}}
\toprule
 Name & ID & Description \\
\midrule
 $\mathit{A}$ & 1 & This is A \\
 $\mathit{B}$ & 2 & This is B \\
\midrule
 $\mathbf{D}$ & 4 & This is D\\
 $\mathbf{E}$ & 5 & This is E\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

image output

1
  • 1
    Your answer perfectly solves my question. Thank you so much for your answer, @Teepeemm! Commented Sep 9, 2021 at 3:25

You must log in to answer this question.

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