
Tengo la siguiente tabla y quiero que 1
aparezca centrada en la columna de la izquierda.
\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}
Respuesta1
He agregado a la solución de David (en un comentario a su pregunta) el ancho \myw
para tener una columna del ancho exacto de la cadena 1
, si también tiene números de 2 o 3 dígitos simplemente cambie \settowidth{\myw}{...}
o coloque el ancho que desee dentro de la definición de la columna. 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}