1

In the first row contents are not aligned to centere

\documentclass{article}
\begin{document}

\begin{table}[h]
 \centering
        \begin{tabular}{|c|c|c|c|c|c|c|}
        \hline
        Awqqf & Bfwqf & Cfwq & \multicolumn{2}{|c|}{D} \\ 
        \cline{4-5}
        & & & L & U\\
       \hline 
        P & & & &\\
        \hline
        Pa& & & &\\
        \hline
       \end{tabular}
\end{table}
\end{document}

enter image description here

  • Welcome, if i add the parts that make the code snippet compilable, i see everything centered. Please provide a minimal working example so we can reproduce your issue. – Johannes_B Mar 5 '17 at 15:40
  • 1
    \multicolumn{2}{|c|}{D} should be \multicolumn{2}{c|}{D} but other than that everything seems centred as specified, what output did you expect? – David Carlisle Mar 5 '17 at 15:41
  • I want A, B, C at center of row (vertically center) – Niranjan PK Mar 5 '17 at 15:48
  • \multirow{2}{*}{A}, ... and multirow package in preamble – Zarko Mar 5 '17 at 15:51
2

For vertical centering of a cell across n rows, load the multirow package and use \multirow{n}{*}{...} directives.

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{table}[ht!]
\centering
        \begin{tabular}{|*{5}{c|}}
        \hline
        \multirow{2}{*}{Awqqf} & \multirow{2}{*}{Bfwqf} & \multirow{2}{*}{Cfwq} & 
        \multicolumn{2}{c|}{D} \\ 
        \cline{4-5}
        & & & L & U\\
       \hline 
        P & & & &\\
        \hline
        Pa& & & &\\
        \hline
       \end{tabular}
\end{table}
\end{document}

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.