In this code, I would like to vertically center the text in the left cells, x = k
and x > k
. I tried with \parbox[c]
:
\documentclass[border=2mm,tikz]{standalone}
\usepackage{tabularx}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{3}
\begin{tabularx}{0.5\textwidth}{ | X | c | }
\hline
\noindent\parbox[c]{\hsize}{$x = k$} & $a = \displaystyle \frac{1}{2}$\\
& $b = \displaystyle \frac{1}{4}$\\[0.4cm]
\hline
\noindent\parbox[c]{\hsize}{$x > k$} & $c = \displaystyle \frac{1}{8}$\\
& $d = \displaystyle \frac{1}{16}$\\[0.4cm]
\hline
\end{tabularx}
\end{table}
\end{document}
However, this is the result:
What is wrong? How to vertically center the contents of those cells?
(The use of \parbox
is not necessary, I just thought it was a solution).