我有这个代码这个问题David Carlisle 回答。
我不完全明白它在做什么。我希望两个表都是全宽的。
下面是一个最小示例,其中我希望第一个表是全宽的。第二个表正常运行。
\documentclass[10pt,a4paper,oneside,onecolumn,openany]{report}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{ragged2e}
\usepackage{longtable}
\usepackage[showframe]{geometry}
\makeatletter
\def\ltabulary{%
\def\endfirsthead{\\}%
\def\endhead{\\}%
\def\endfoot{\\}%
\def\endlastfoot{\\}%
\def\tabulary{%
\def\TY@final{%
\def\endfirsthead{\LT@end@hd@ft\LT@firsthead}%
\def\endhead{\LT@end@hd@ft\LT@head}%
\def\endfoot{\LT@end@hd@ft\LT@foot}%
\def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}%
\longtable}%
\let\endTY@final\endlongtable
\TY@tabular}%
\tabulary}
\def\endltabulary{\endtabulary}
\makeatother
\begin{document}
\hspace*{0pt}\tymin=50pt\tymax=400pt\begin{ltabulary}{\textwidth}{|L|L|} \hline
\rule{0pt}{4mm}\textbf{\hspace*{0pt}Fuz} & \textbf{\hspace*{0pt}Baz} \\ \hline
\rule{0pt}{4mm}A & B \\ \hline
\rule{0pt}{4mm}C & D \\ \hline
\end{ltabulary}
\hspace*{0pt}\tymin=50pt\tymax=400pt\begin{ltabulary}{\textwidth}{|L|L|} \hline
\rule{0pt}{4mm}\textbf{\hspace*{0pt}Fuz} & \textbf{\hspace*{0pt}Baz} \\ \hline
\rule{0pt}{4mm}AAAAAAAAAA & BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB \\ \hline
\rule{0pt}{4mm}C & D \\ \hline
\end{ltabulary}
\end{document}
输出:
谢谢。
答案1
答案2
\documentclass{article}
\usepackage{tabularx,ragged2e,booktabs,lipsum}
\newcommand\mydesc[2]{#1 & #2 \\ \addlinespace}
\begin{document}
\noindent % <-- may be omitted if `\parindent` is equal to 0pt
\begin{tabularx}{\textwidth}{@{} w{l}{0.5\textwidth} >{\RaggedRight}X @{}}
\toprule
\multicolumn{1}{c}{\textbf{Fuz}}& \multicolumn{1}{c}{\textbf{Baz}}\\
\midrule
{Lorem}&{\lipsum[1][1-4]}\\
\midrule
{Ipsum}&{\lipsum[2][1-3]}\\
\bottomrule
\end{tabularx}
X\hrulefill X
\end{document}