Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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??

share|improve this question

2 Answers 2

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.

share|improve this answer
    
Or even in all columns. –  egreg Apr 1 at 13:44
    
@egreg probably yes, to be on the safer side. :) –  Harish Kumar Apr 1 at 13:45

If you are willing to manually do the linebreaks within a row yourself, you can use a \Centerstack, as shown here. In that case though, the p columns are not really needed, unless you want them for their width. You can dispense with them by deleting that declaration and uncommenting the 3 other lines in my code.

\documentclass{article}
\usepackage{array}
\usepackage[usestackEOL]{stackengine}
%\edef\tmp{\the\baselineskip}
%\setstackgap{L}{\tmp}
\begin{document}
   \begin{table}[!htbp]
 \centering
 \caption{Spanish Traffic Sign according to the color and shape \cite{Paper12}}
%\begin{tabular}{|l|l|l|}
  \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 & \Centerstack[l]{End of\\ Prohibition\\ (construction)}\tabularnewline
      \hline
       \end{tabular}
       \label{Spanish_TS}
       \end{table}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.