[Tex/LaTex] Easy vertical alignment in Tabulary balanced columns

ieeetrantabularyvertical alignment

I want to vertically center the text in all table cells. However, I do not wish to specify fixed column widths but rather leave it to tabulary to balance the column widths. How do I properly use column specifiers in this situation?

Easy solutions for regular use will be appreciated. Are there other LaTeX packages that do both column width balancing and better vertical alignment?

I do not know if the use of the IEEEtran class(v1.8b) is significant to my problem.

\documentclass[conference]{IEEEtran}
\usepackage{tabulary}
\usepackage{booktabs}
\begin{document}

\begin{table}[!h]
\renewcommand{\arraystretch}{1.3}
\caption{Comparison of Algorithm Results}
\centering

\begin{tabulary}{\columnwidth}{@{\hspace{.2em}}L*{4}{C}@{}}
\toprule
\textbf{Optimization Algorithm} & \textbf{Swarm Size} & \textbf{No. of Iterations} & \textbf{Final Wirelength} & \textbf{Best Value Cost Fn.}\\ \midrule
Short Text                      & 10    & 1000  & 100   & --    \\
Slightly Longer Text that Wraps & 20    & 2000  & 200   & 10.5  \\
Slightly Longer Text that Wraps & 30    & 3000  & 300   & 20.55 \\
Short                           & 40    & 4000  & 400   & 30.5  \\
\bottomrule
\end{tabulary}

\end{table}
\end{document}

enter image description here

Best Answer

You can "hack" the tabulary definition to vertically align all LRCJ columns.

\makeatletter
\def\TY@box@v#1{%
      $\vcenter \@startpbox{\csname TY@F\the\TY@count\endcsname}%
              #1\arraybackslash\tyformat
                              \insert@column\@endpbox$}
\makeatother
Related Question