title: Vertical Alignment of text in a table in Latex (Overleaf)
body: <p>I have the following sample code in overleaf to generate a table.</p>
  <pre><code>\documentclass[hidelinks,a4paper,12pt,oneside]{article}
  \usepackage[utf8]{inputenc}
  \usepackage[margin=1in]{geometry}
  \usepackage{multicol}
  \usepackage{multirow}
  \usepackage{array}
      \newcolumntype{P}[1]{&gt;{\centering\arraybackslash}p{#1}}
      \newcolumntype{M}[1]{&gt;{\centering\arraybackslash}m{#1}}
  
  \usepackage{stackengine}
      \newcommand\xrowht[2][0]{\addstackgap[0.5\dimexpr#2\relax]{\vphantom{#1}}}
      
  \title{table}
  \begin{document} 
  \maketitle
  
  
  \begin{table}[ht]
  \footnotesize
      \centering
      \begin{tabular}{|P{0.75cm}|P{1.25cm}|P{0.75cm}|P{0.75cm}|P{0.75cm}|P{0.75cm}|P{0.75cm}|P{1cm}|P{1cm}|P{1cm}|P{1cm}|P{0.75cm}|}
      \hline\xrowht[()]{15pt}
           \multirow{2}{*}{Test} &amp; \multirow{2}{*}{Name} &amp; \multicolumn{3}{c|}{Domain} &amp; \multirow{2}{*}{Cell} &amp; \multicolumn{4}{c|}{MLR} &amp; \multirow{2}{*}{$C_1$} &amp; \multirow{2}{*}{$C_2$}\\
           \cline{3-5}\cline{7-10}\xrowht[()]{15pt}
           No &amp; &amp; x &amp; y &amp; z &amp; Size &amp; $\dot{m_t}$ &amp; $\dot{m}_{in}$ &amp; $\dot{m}_{out}$ &amp; $\dot{m}_{avg}$ &amp; &amp; \\
           \hline\xrowht[()]{15pt}
           1 &amp; Mass1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 \\
           \hline\xrowht[()]{15pt}
           2 &amp; Mass2 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; 0.1 &amp; \multicolumn{2}{c|}{0.1}  &amp; 0.1 &amp; 0.1 &amp; 0.1 \\
           \hline
           \end{tabular}
           \vspace{0.5cm}
      \caption{Tests}
  \end{table}
  
  
  \end{document}
  </code></pre>
  <p>This gives me,</p>
  <p><a href="https://i.stack.imgur.com/EeRPW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EeRPW.png" alt="enter image description here" /></a></p>
  <p><strong>Problem:</strong> I cannot get the vertical alignement of the texts inside the table to center or any other position for that matter. For example, the texts &quot;Test No&quot;, &quot;Name&quot;, &quot;Cell Size&quot;, &quot;C1&quot; and &quot;C2&quot;, are supposed to be vertically center aligned. Further I see that using <code>\hline\xrowht[()]{15pt}</code> gives me different box width ,<strong>see &quot;Domain&quot; and &quot;MLR&quot; boxes</strong>. Can anybody please help me setup this table in a proper way?</p>
  <p>Thanks everyone</p>