# Use varwidth to make a paragraph center in a table

The following code does what I want, except the V acts like the p option, but I want the m option.

\documentclass[12pt]{memoir}
\usepackage{varwidth}
\begin{document}
\begin{tabular}{lV{2in}}\hline
Cat & Animal\newline Cute\newline Very furry\newline Spotted\\
\end{tabular}
\end{document}


If I use m I have to manually figure out the length of the longest item in the second column, but the word "Cat" is vertically centered like I want it.

\documentclass[12pt]{memoir}
\usepackage{varwidth}
\begin{document}
\begin{tabular}{lm{2in}}\hline
Cat & Animal\newline Cute\newline Very furry\newline Spotted\\
\end{tabular}
\end{document}


Here's what they look like:

I only found the V option via an Internet search; the varwidth manual is surprising sparse.

How do I get a table option that combines array's m and varwidth's V? (I'm actually using memoir's implementation of array if that matters.

I didn't know that varwidth defines the V column type. Now I know! ;-).

Its definition is

\newcolumntype{V}[1]{%
>{\begin{varwidth}[t]{#1}\narrowragged\let\\\tabularnewline}%
l%
<{\@finalstrut\@arstrutbox\end{varwidth}}}


so you should get what you want by

\documentclass[12pt]{memoir}
\usepackage{varwidth}

\makeatletter
\newcolumntype{M}[1]{%
>{\begin{varwidth}{#1}\narrowragged\let\\\tabularnewline\strut}%
l%
<{\@finalstrut\@arstrutbox\end{varwidth}}}
\makeatother

\begin{document}
\begin{tabular}{lM{2in}}\hline
Cat & Animal\newline Cute\newline Very furry\newline Spotted\\
\end{tabular}
\end{document}


Notice that memoir loads array (actually it has code to that effect); with other classes it will be necessary to add

\usepackage{array}


• Yay! This works, though I was getting some really weird stuff until I realized I hadn't copied the \makeatletter part! Mar 11, 2014 at 21:16
• @bombcar That's implicit in .sty files, so it wasn't there to begin with. Mar 11, 2014 at 21:17

I'm not sure I fully understand your question, but does this answer give you the desired output? If so, I guess the question is then whether the syntax works for you.

\documentclass[12pt]{memoir}
\usepackage{stackengine}
\setstackEOL{\newline}
\setstackgap{L}{13pt}
\begin{document}
\begin{tabular}{ll}\hline
Cat & \Centerstack[l]{Animal\newline Cute\newline Very furry\newline Spotted}\\
\end{tabular}
\end{document}


• What is stackengine? I don't have it. The normal l enviroment doesn't do what I want with very long lines such as "Incredibly awesomely furry and powerful". Mar 11, 2014 at 20:20