2

My code are follows:

\documentclass{book}

\begin{document}

\begin{tabular}{c|l}
Test &Trial\\
Trial &Test\\
& Test
\end{tabular}

\end{document}

Vertical rule should be on the exact top and bottom of the table, is it possible to fix? Please advise...

enter image description here

  • is it something to do with centered cell alignment? if so, this might help you: tex.stackexchange.com/questions/7208/… – Raaja Aug 27 '18 at 7:35
  • @Raaja Thanks for your suggestion, but it was not help me to meet the requirement, anyway, thanks a lot.... – MadyYuvi Aug 27 '18 at 9:43
  • Can you please tell what's the use of this? – egreg Aug 28 '18 at 20:38
2

This "misalignment" is due to the linespace of your document. You could decrease the space be putting the table in a spacing environment as follows:

\documentclass{book}
 \usepackage{setspace}

\begin{document}

Before:

\begin{tabular}{c|l}
\hline
Test &Trial\\
Trial &Test\\
& Test \\
\hline
\end{tabular}


After:

\begin{spacing}{0.5}
 \begin{tabular}{c|l}
    \hline
    Test &Trial\\
    Trial &Test\\
    & Test \\
    \hline
 \end{tabular}
\end{spacing}

\end{document}

Note, that I inserted \hlines for better visualisation.

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.