# How do I align the following table cell in the middle?

I have the following table, and I want the 1 to appear centered in the left column.

\documentclass{article}

\begin{document}

\begin{tabular}{|l|p{1in}|}
\hline
1 & a b c d e f g h i j k l m n o p q r s t u v w x y z \\
\hline
\end{tabular}

\end{document}

• change l to c in the tabular argument (or do you mean vertical center, in which case change to m and add \usepackage{array}) Apr 28 '17 at 16:16
• @DavidCarlisle I think he/she is talking vertical centering... Apr 28 '17 at 16:17
• Cumbersome, but, 1 & \parbox[c]{1in}{a b c d e f g h i j k l m n o p q r s t u v w x y z} Apr 28 '17 at 16:19
• @DavidCarlisle only if you also include the array or tabularx package... Apr 28 '17 at 16:20
• @DavidCarlisle You edited your comment without me noticing... two can play at that game. Apr 28 '17 at 16:23

I have added to David's solution (in a comment to your question) the width \myw to have a column of the exact width of the string 1, if you also have numbers of 2 or 3 digits just change \settowidth{\myw}{...} or put any width you like within the column definition m{...}.

\documentclass{article}
\usepackage{array}
\newlength{\myw}
\settowidth{\myw}{1}

\begin{document}
\noindent\emph{David's solution (with \textbackslash\texttt{array} package)}

Note that both colums must have \texttt{m\{\dots\}} type.
\begin{center}
\begin{tabular}{|m{\myw}|m{1in}|}
\hline
1 & a b c d e f g h i j k l m n o p q r s t u v w x y z \\
\hline
\end{tabular}
\end{center}

\noindent\emph{Steven's solution (with no extra packages)}

Note that it's necessary to explicity give the height of the \arraybackslash\texttt{parbox}.
Otherwise, the lines overlap the text.
\begin{center}
\begin{tabular}{|l|p{1in}|}
\hline
1 & \parbox[c][1.2\height]{1in}{a b c d e f g h i j k l m n o p q r s t u v w x y z}\\
\hline
\end{tabular}
\end{center}
\end{document}