0

Suppose that we have this code:

\begin{table}
\caption{xxxx.}
\centering
\begin{tabular}{|c|c|}
  \hline
  \rowcolor{Gray}
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
  1 & AAAAAAAAAAAAAAAA/BBBCCCCCCCC \\
  \hline
  2 & SDSDSDSDSD/FDFDFDFDF \\
  \hline
    2 & gGGGGGGGGG/TTTTTTTTTT \\
  \hline
  \rowcolor{Gray}
\end{tabular}
\label{table:QQ}
\end{table}

The output of this table is:

enter image description here

As you can see the height of table rows is not fix with font size (+texts are not in center of every cell/we have tendency to upward) . Why we have this behavior in default table appearance? How can i have a table with better appearance?

1 Answers1

0

You can use the cellspace package, which lets you define a minimal vertical spacing between a row and the above and below rows. Additionnally, I loaded the caption package to ensure a correct vertical spacing between caption and table:

\documentclass{article}
\usepackage{array, caption}
\usepackage[table, svgnames]{xcolor}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{table}
\caption{xxxx.}
\centering
\begin{tabular}{|Sc|Sc|}
  \hline
  \rowcolor{Gray}
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
  1 & AAAAAAAAAAAAAAAA/BBBCCCCCCCC \\
  \hline
  2 & SDSDSDSDSD/FDFDFDFDF \\
  \hline
    2 & gGGGGGGGGG/TTTTTTTTTT \\
  \hline
  \rowcolor{Gray}
\end{tabular}
\label{table:QQ}
\end{table}

\end{document} 

enter image description here

Bernard
  • 271,350