并排复选框后的多行右对齐文本

并排复选框后的多行右对齐文本

下面是我正在创建的表单的最小工作示例。

我有一个枚举列表。每个项目都是一个标题,后面是描述,然后是一些选项。选项右侧是一些我希望右对齐的文本。有很多这样的项目。

我不知道如何用语言最好地表达我想要的视觉效果,所以我下面附上的图片是为了说明这一点。我最初尝试使用列表中并排的复选框我使用了三列列表,但文本对于第三项来说总是太长,并且永远无法全部位于最左侧。

\documentclass[11pt, letterpaper, oneside, final]{memoir}
\usepackage{enumitem, amssymb}
\setlist[itemize]{noitemsep, topsep=0pt}

\begin{document}

\begin{enumerate}[leftmargin=*]
\item \textbf{Item title}\\
\noindent Some description text here. Below are the choices.

\noindent
$\square$ YES \qquad $\square$ NO \hfill {\small This is some filler text to make a point. I would like 

\hfill this part of the text to be right aligned without the awkward space above.\\}
$\square$ YES \qquad $\square$ NO \hfill {\small The quick brown fox jumped over the lazy dog. \\} 
$\square$ YES \qquad $\square$ NO \hfill {\small The quick brown fox jumped over the lazy dog. \\} 
$\square$ YES \qquad $\square$ NO \hfill {\small The quick brown fox jumped over the lazy dog. \\} 
\end{enumerate}
\end{document}

在此处输入图片描述

我希望复选框右侧的描述能够在复选框之后开始,能够有多行并且始终右对齐,而不会出现尴尬的空格。

答案1

解决方案如下tabularx

\documentclass[11pt, letterpaper, oneside, final, showframe]{memoir}
\usepackage{enumitem, amssymb}

\begin{document}

\begin{enumerate}[leftmargin=*, before =\setlength{\tabcolsep}{3pt}]
  \item \textbf{Item title}

        Some description text here. Below are the choices. Some description text here. Below are the choices.

        \begin{tabularx}{\linewidth}{@{}>{$\square$ YES \qquad $\square$ NO}l >{\small\raggedleft\arraybackslash}X@{}}
           & This is some filler text to make a point. I would like this part of the text to be right aligned without the awkward space above. \\
           & The quick brown fox jumped over the lazy dog. \\
           & The quick brown fox jumped over the lazy dog. \\
           & The quick brown fox jumped over the lazy dog.
        \end{tabularx}
\end{enumerate}

\end{document}

在此处输入图片描述

相关内容