为什么此表格比指定的宽度窄?

为什么此表格比指定的宽度窄?

为什么这tabulary比指定的宽度窄?

\documentclass{article}
\usepackage{tabulary}

\newcommand{\mytable}{%
    \begin{tabulary}{0.5\textwidth}{@{}L@{}}
    Text\\
    Text\\[2ex]
    \end{tabulary}%
}
\setlength{\parindent}{0pt}

\begin{document}

% Why are these less than 0.5\textwidth?
\mytable 
\mytable 
\mytable 
\mytable

\makebox[0.5\textwidth]{\mytable}
\makebox[0.5\textwidth]{\mytable}
\makebox[0.5\textwidth]{\mytable}
\makebox[0.5\textwidth]{\mytable}

\end{document}

在此处输入图片描述

答案1

不是,如果您提供足够的文本来至少填充规定的宽度,否则列将设置为其自然宽度。

\documentclass{article}
\usepackage{tabulary,lipsum}

\newcommand{\mytable}{%
  \begin{tabulary}{0.5\textwidth}{@{}L@{}}
  \lipsum*[2]\\
  \end{tabulary}%
}
\setlength{\parindent}{0pt}

\begin{document}

% Why are these less than 0.5\textwidth?

\rule{0.5\textwidth}{0.4pt}% to show the stated width

\medskip

\mytable 

\medskip

\begin{tabulary}{0.5\textwidth}{@{}|L|@{}} % add rules to show the width
text\\
\end{tabulary}

\end{document}

在此处输入图片描述

相关内容