次の表のセルを中央に揃えるにはどうすればよいでしょうか?

次の表のセルを中央に揃えるにはどうすればよいでしょうか?

次のような表があり、1左の列の中央に表示したいと考えています。

\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}

答え1

David のソリューションに (質問へのコメントで)\myw文字列の正確な幅の列を持つための幅を追加しました1。2 桁または 3 桁の数字もある場合は、列定義内で任意の幅を変更する\settowidth{\myw}{...}か、入力します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}

ここに画像の説明を入力してください

関連情報