单列 Tabularx

单列 Tabularx

我想创建一个固定宽度的单列,其中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

erikTabularx

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

相关内容