需要拉伸第二列所有行中的文本,直到它们与右边距齐平

需要拉伸第二列所有行中的文本,直到它们与右边距齐平

我喜欢这个表格的显示方式。我只需要行和第二列中的内容与右边距齐平。

\documentclass[10pt]{amsart}

\usepackage{mathtools,array}


\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}



\begin{document}
The following list composes the first verses of some old, famous nursery rhymes. They are ``Mary Had a Little Lamb,'' ``Baa, Baa, Black Sheep,'' and ``Hickory, Dickory, Dock.'' All originated in England.

\begin{tabular}{@{}r@{\textbf{ }}l}
\textbf{i.) }&{\em Mary had a little lamb, Its fleece was white as snow, yeah. Everywhere the child went, The} \\
&{\em little lamb was sure to go, yeah.} \\
\textbf{ii.) }&{\em Baa, baa, black sheep Have you any wool? Yes sir, yes sir Three bags full. One for my} \\
&{\em master And one for the dame One for the little boy Who lives down the lane.} \\
\textbf{iii.) }&{\em Hickory, dickory, dock The mouse ran up the clock. The clock struck one The mouse ran} \\
&{\em down Hickory, dickory, dock.}
\end{tabular}


\end{document}

答案1

使用tabular环境需要大量的视觉格式。我建议切换到自定义enumerate环境。

请看以下屏幕截图。(文本块两侧的框线由选项绘制showframe;请在实际文档中省略它。)

在此处输入图片描述

  • 三个文本组中的第一个采用了 OP 的原始的tabular基于 的代码。

  • 中间组切换到一个enumerate环境,该环境根本不使用任何视觉格式。请注意\raggedright“before”选项中的指令,该指令用于使中间文本组在视觉上几乎与第一个文本组没有区别。

  • 第三个取消了\raggedright选项,因此完全适用。我认为这就是你想要的。


\documentclass[10pt]{amsart}

\usepackage[textheight=9in,textwidth=6.1in,showframe]{geometry}
\usepackage{enumitem}

\begin{document}
\null % just for this example

\begin{tabular}{@{}r@{\textbf{ }}l}
\textbf{i.) }&{\em Mary had a little lamb, Its fleece was white as snow, yeah. Everywhere the child went, The} \\
&{\em little lamb was sure to go, yeah.} \\
\textbf{ii.) }&{\em Baa, baa, black sheep Have you any wool? Yes sir, yes sir Three bags full. One for my} \\
&{\em master And one for the dame One for the little boy Who lives down the lane.} \\
\textbf{iii.) }&{\em Hickory, dickory, dock The mouse ran up the clock. The clock struck one The mouse ran} \\
&{\em down Hickory, dickory, dock.}
\end{tabular}

\bigskip
\begin{enumerate}[label=\upshape\bfseries\roman*.),
                  labelwidth=3em,
                  before=\itshape\raggedright]
\item Mary had a little lamb, Its fleece was white as snow, yeah. Everywhere the child went, The little lamb was sure to go, yeah.
\item Baa, baa, black sheep Have you any wool? Yes sir, yes sir Three bags full. One for my master And one for the dame One for the little boy Who lives down the lane.
\item Hickory, dickory, dock The mouse ran up the clock. The clock struck one The mouse ran down Hickory, dickory, dock.
\end{enumerate}

\bigskip
\begin{enumerate}[label=\upshape\bfseries\roman*.),
                  labelwidth=3em, 
                  before=\itshape] % <-- note: no "\raggedright"
\item Mary had a little lamb, Its fleece was white as snow, yeah. Everywhere the child went, The little lamb was sure to go, yeah.
\item Baa, baa, black sheep Have you any wool? Yes sir, yes sir Three bags full. One for my master And one for the dame One for the little boy Who lives down the lane.
\item Hickory, dickory, dock The mouse ran up the clock. The clock struck one The mouse ran down Hickory, dickory, dock.
\end{enumerate}

\end{document}

相关内容