
다음 테이블이 있고 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}