[Tex/LaTex] How to vertically align text in table cell

bibtextablesvertical alignment

Here is the latex code to create a table in BibTxtMng

 \begin{table}[!htbp]
 \centering
 \caption{Spanish Traffic Sign according to the color and shape \cite{Paper12}}
  \begin{tabular}{|>{\raggedright}p{3.1cm}|>{\raggedright}p{3.1cm}|>
   {\raggedright}p{3.1cm}|}
   \hline
   Color          & Shape    & Meaning \tabularnewline
   \hline
    Red Rim        & Circle   & Prohibition\tabularnewline
    \hline
    Red Rim (Up)   & Triangle & Danger      \tabularnewline
    \hline
     Red Rim (Down) & Triangle & Yield       \tabularnewline
    \hline
        Red            & Octagonal & Stop\tabularnewline
    \hline
      Blue  & Square &  Recommendation \tabularnewline
       \hline
      Blue &    Circle &    Obligation \tabularnewline
     \hline
     White  & Circle    & End of Prohibition \tabularnewline
     \hline
    Yellow & Circle & End of Prohibition (construction)\tabularnewline
      \hline
       \end{tabular}
       \label{Spanish_TS}
       \end{table}

Here is the output table I got

enter image description here

I want that yellow and circle text (in the last row) being located in the centre of vertical. Not tin the top like that..

How to do it??

Best Answer

You can use m column specifier for the last cell in last row.

\documentclass{article}
\usepackage{array}             %% you need this
\begin{document}
   \begin{table}[!htbp]
 \centering
 \caption{Spanish Traffic Sign according to the color and shape \cite{Paper12}}
  \begin{tabular}{|>{\raggedright}p{3.1cm}|>{\raggedright}p{3.1cm}|>
   {\raggedright}p{3.1cm}|}
   \hline
   Color          & Shape    & Meaning \tabularnewline
   \hline
    Red Rim        & Circle   & Prohibition\tabularnewline
    \hline
    Red Rim (Up)   & Triangle & Danger      \tabularnewline
    \hline
     Red Rim (Down) & Triangle & Yield       \tabularnewline
    \hline
        Red            & Octagonal & Stop\tabularnewline
    \hline
      Blue  & Square &  Recommendation \tabularnewline
       \hline
      Blue &    Circle &    Obligation \tabularnewline
     \hline
     White  & Circle    & End of Prohibition \tabularnewline
     \hline
    Yellow & Circle & \multicolumn{1}{|m{3.1cm}|}{End of Prohibition (construction)}\tabularnewline
      \hline
       \end{tabular}
       \label{Spanish_TS}
       \end{table}
\end{document}

enter image description here

You may use the m column specifier for all columns if you have variable width text in them to have vertical alignment.

Related Question