# [Tex/LaTex] Horizontal line \hline inconsistent behaviour

horizontal alignmenttables

Trying to make a table with the following code

\begin{table}[h]
\caption{Different scans conducted with the Catphan.}
\begin{tabularx}{\linewidth}{|l|X|X|c|X|}
\hline
\rowcolor{slightgray}
\T Phantoms &Mode  &Position &Times Scanned &mAs\B\\
\hline
\cellcolor{slightgray}\T Catphan &Head-Slow &Centered &1 &60\B\\
\hline
\cellcolor{slightgray}\T Catphan &Head &Centered &10 &60\B\\
\hline
\cellcolor{slightgray}\T Catphan &Pelvis &Centered &1 &60\B\\
\hline
\cellcolor{slightgray}\T Catphan and Annulus &Pelvis &Centered &1 &60\B\\
\hline
\cellcolor{slightgray}\T Catphan and Annulus &Pelvis &Centered &1 &100\B\\
\hline

\end{tabularx}
\label{tab:example}
\end{table}


The table that I get looks like :

I cannot figure out why there is a horizontal line under the first Catphan and a vertical line before and after Times Scanned column heading.

I am using a latex template. First I thought \T and \B are part or tabularx but upon inspection could not find them. In the example with the template \T and \B are mentioned to increase the cell size slightly. I removed all \T and \B from the code and the result looks like:

The vertical lines seem to go away and the horizontal line moves down a row.
@David Thanks for the reply. I moved the caption down and it seems to be working fine. I guess I should look into the backend before posting here. Anyway thanks for the help!

Even after your edit of question it is still cryptic to me. So on basis of guessing and a bit of considering, how I will wrote similar table, I made the following example:

\documentclass{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{siunitx}

\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.5}
\sffamily
\caption{Different scans conducted with the Catphan.}
\begin{tabularx}{\linewidth}{lXX*2{S[table-format=2.0]}}%>{\columncolor{gray!30}}
\hline
\rowcolor{gray!30}
Phantoms &Mode  &Position &{Times Scaned} &{mAs} \\
\hline
Catphan &Head-Slow &Centered &1 &60 \\
\hline
Catphan &Head &Centered &10 &60 \\
\hline
Catphan &Pelvis &Centered &1 &60 \\
\hline
Catphan and Annulus &Pelvis &Centered &1 &60\\
\hline
Catphan and Annulus &Pelvis &Centered &1 &100\\
\hline
\end{tabularx}
\label{tab:example}
\end{table}
\end{document}


Edit: With use of package caption the distance between caption and table is bigger (as mentioned Bernard in his comment). Also without horizontal lines the table look better:

Modified code is:

\documentclass{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}

\usepackage{siunitx}
\usepackage{caption}

\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.3}
\sffamily
\caption{Different scans conducted with the Catphan.}
\begin{tabularx}{\linewidth}{%>{\columncolor{gray!30}}
lXX*2{S[table-format=2.0]}}
\hline
\rowcolor{gray!30}
Phantoms &Mode  &Position &{Times Scaned} &{mAs} \\
\hline
Catphan &Head-Slow &Centered &1 &60 \\
Catphan &Head &Centered &10 &60 \\
Catphan &Pelvis &Centered &1 &60 \\
Catphan and Annulus &Pelvis &Centered &1 &60\\
Catphan and Annulus &Pelvis &Centered &1 &100\\
\hline
\end{tabularx}
\label{tab:example}
\end{table}
\end{document}