# How to vertically center align text vertically in table with itemize in other columns

I want to vertically center align texts in a cell of a table other columns of which contains itemize lists. Stumbling upon this question, I tried to implement the accepted answer there. But that is not working when I add the second row. Following is an MWE:

\documentclass{article}
\usepackage{array}
\usepackage{enumitem}
\newcolumntype{M}[1]{%
>{\begin{minipage}{#1}}
m{#1}
<{\end{minipage}}
}
\begin{document}
\begin{table}[h!]
\setlist[itemize]{leftmargin=12pt}
\centering
\begin{tabular}{|m{0.05\linewidth}|M{0.25\linewidth}|M{0.25\linewidth}|M{0.25\linewidth}|}
\hline
&   \multicolumn{1}{c|}{\textbf{Arts}} & \multicolumn{1}{c|}{\textbf{Science}} & \multicolumn{1}{c|}{\textbf{Commerce}}\\
\hline
UG &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item English
\item Education
\item Geography
\item History
\item Mass Communication \& Journalism
\item Political Science
\item Psychology
\item Sociology
\item Bachelor of Social Work
\item Physical Education (as general subject)
\end{itemize} &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item Computer Science
\item Economics
\item Mathematics
\item Physics
\item Statistics (as general subject)
\end{itemize} &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item B. Com. Honours
\item B. Com. General
\end{itemize}\\
\hline
PG &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item Education
\item English
\item Psychology
\end{itemize}
& &\\
\hline
\end{tabular}
\end{table}
\end{document}


I want vertically center alignment in the first column only. Rest of the columns should be top aligned. Please help me to achieve this.

With use of the multirow cells:

\documentclass{article}
\usepackage{geometry}                       % <---
\usepackage{ragged2e}                       % <---
\usepackage{makecell, multirow, tabularx}   % <---
\newcolumntype{L}{>{\RaggedRight}X}         % <---
\usepackage{enumitem}
\usepackage{etoolbox}                       % <---
\AtBeginEnvironment{table}{%                % <---
\setlist[itemize]{nosep,
leftmargin=*,
label=\textbullet,
before=\begin{minipage}[t]{\linewidth},
after=\end{minipage}}
}

\begin{document}
\begin{table}[ht]
\centering
\setlength\tabcolsep{4pt}   % <---
\setcellgapes{3pt}          % <---
\makegapedcells             % <---
\begin{tabularx}{\linewidth}{|c|*{3}{L|}}    % <---
\hline
\hline
\multirow{12}{*}{UG}
&   \begin{itemize}
\item English
\item Education
\item Geography
\item History
\item Mass Communication \& Journalism
\item Political Science
\item Psychology
\item Sociology
\item Bachelor of Social Work
\item Physical Education (as general subject)
\end{itemize}   &   \begin{itemize}
\item Computer Science
\item Economics
\item Mathematics
\item Physics
\item Statistics (as general subject)
\end{itemize}   &   \begin{itemize}
\item B. Com. Honours
\item B. Com. General
\end{itemize}   \\
\hline
\multirow{3}{*}{PG}
&   \begin{itemize}
\item Education
\item English
\item Psychology
\end{itemize}   &                   &                   \\
\hline
\end{tabularx}
\end{table}
\end{document}


As you can notice, in above MWE are introduced packages:

• geometry for making \textwidth larger
• ragged2e for left aligning of cells contents
• enumitem for defining lists used in table
• etoolbox for defining itemize properties in tables

I propose to do that with tabularx and multirow:

\documentclass{article}
\usepackage{array, multirow, tabularx, makecell}
\usepackage{enumitem}

\makeatletter
\newcommand\compress{\@minipagetrue}
\makeatother

\begin{document}

\begin{table}[h!]
\setlist[itemize]{topsep=0pt, itemsep=0.5ex, wide=0pt, leftmargin=*,after=\vspace{-\baselineskip}}
\centering
\begin{tabularx}{\linewidth}{|m{0.05\linewidth}|*{3}{>{\compress\arraybackslash}X|}}
\hline
& \multicolumn{1}{c|}{\textbf{Arts}} & \multicolumn{1}{c|}{\textbf{Science}} & \multicolumn{1}{c|}{\textbf{Commerce}}\\
\hline
\multirow{20}{=}{UG} &
\begin{itemize}
\item English
\item Education
\item Geography
\item History
\item Mass Communication \& Journalism
\item Political Science
\item Psychology
\item Sociology
\item Bachelor of Social Work
\item Physical Education (as general subject)
\end{itemize} &
\begin{itemize}
\item Computer Science
\item Economics
\item Mathematics
\item Physics
\item Statistics (as general subject)
\end{itemize} &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item B. Com. Honours
\item B. Com. General
\end{itemize}\tabularnewline
\hline
\multirow{4.2}{=}{PG} &
\begin{itemize}[topsep=0pt, itemsep=0.5ex]
\item Education
\item English
\item Psychology
\end{itemize}
& &\\
\hline
\end{tabularx}
\end{table}

\end{document}


• @Mico: it does not completely overrides in this context: there is no label indent (and therefore slighly more space for the items text), but all lines of a multiline item are aligned on the left with the first one. – Bernard Jan 11 at 19:21
• @Bernard It is a rare occasion of fortunate misfortune for the OP to not being able to accept both the answers at the same time. Thank you so very much for your solution. Can you please enlighten me about the arguments of \multirow?, i.e., \multirow{20}{=} and \multirow{4.2}{=}? – Subhajit Paul Jan 11 at 19:58
• The {=} can be used in a fixed width column, as you have: it tells latex that the \multirow has the same fixed width, and hence if its contents a=is long, it can be wrapped. As to the numbers, you have to know that it corresponds to the number of rows that will be used only these rows are one-lined. In other cases to obtain something visually acceptable, you have to count the number of equivalent one-lined rows – this is the case here, and it is not automatic, but has to be done by trial and error. Notice that you can use a non-integer number of rows. to fine-tune the vertical placement. – Bernard Jan 11 at 20:17
• @Bernard - Thanks for the clarification. I've deleted my earlier comment. – Mico Jan 11 at 20:49