
Eu tenho a tabela a seguir e quero que 1
apareça centralizada na coluna da esquerda.
\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}
Responder1
Adicionei na solução do David (em um comentário à sua pergunta) a largura \myw
para ter uma coluna com a largura exata da string 1
, se você também tiver números de 2 ou 3 dígitos basta alterar \settowidth{\myw}{...}
ou colocar a largura que desejar dentro da definição da coluna 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}