我想创建一个固定宽度的单列,其中tabularx
文本居中且完全封闭。由于某种原因,单元格的宽度与表格不匹配。
我怎样才能实现这个目标?
谢谢!
\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\begin{document}
{\renewcommand{\arraystretch}{1.5}
\begin{minipage}{\linewidth}
\begin{center}
\begin{tabularx}{5cm}{|c|}
\hline
First Argument\\ \hline
Second long Argument\\ \hline
Third Argument\\ \hline
\end{tabularx}
\end{center}
\end{minipage}
\end{document}
答案1
\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{array}
\begin{document}
\blindtext
\begin{center}
\begin{minipage}{\linewidth}
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|>{\centering\arraybackslash}p{5cm}|}
\hline
First Argument\\ \hline
Second long Argument\\ \hline
Third Argument\\ \hline
\end{tabular}
\end{minipage}
\end{center}
\blindtext
\end{document}