如何在嵌套枚举中设置问题宽度

如何在嵌套枚举中设置问题宽度

根据答案这里,我想在嵌套枚举中对齐 XXX 和 YY

\documentclass[a4paper,12pt]{article}
\usepackage{tabto}
\usepackage{newtxtext}
\usepackage{enumitem}

% Margins
\usepackage[
top=2.5cm,
bottom=2.5cm,
left=20mm,
right=20mm
]{geometry}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}
\item \parbox[t]{125mm}
{
What is your name?
\hfill (16)
}
\parbox[t]{10mm}{~} 
\parbox[t]{20mm}{XXX}
\parbox[t]{20mm}{YY}
%
\item \parbox[t]{125mm}{
What is your name? What is your name? What is your name? What is your name? What is your name? What is your name?
\hfill
(8)
}   
\parbox[t]{10mm}{~} 
\parbox[t]{20mm}{XXX}
\parbox[t]{20mm}{YY}
\end{enumerate}
%       
\begin{enumerate}[resume]
\item \parbox[t]{125mm}
{
\begin{enumerate}
\item What is your name?
\hfill (16)
\parbox[t]{10mm}{~} 
\parbox[t]{20mm}{XXX}
\parbox[t]{20mm}{YY}
%
\item What is your name?
\hfill (16)
\parbox[t]{10mm}{~} 
\parbox[t]{20mm}{XXX}
\parbox[t]{20mm}{YY}
\end{enumerate}
}
%
\end{enumerate}
%
\end{document}

在此处输入图片描述

答案1

像这样?

\documentclass[a4paper,12pt]{article}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
\usepackage[latin, english]{babel}
%---------------------------------------------------------------%
\usepackage[vmargin=2.5cm,
            hmargin=20mm
            ]{geometry}
\usepackage{tabto}
\usepackage{newtxtext}
\usepackage{enumitem}
\newcommand\D[3]{\begin{tabular}{p{10mm}p{20mm}p{20mm}}
                    (#1)    & #2    & #3
                 \end{tabular}
                 }   

\begin{document}

\begin{enumerate}
\item   \parbox[t]{0.55\linewidth}{\raggedright
What is your name?
                                   }\hfill\D{16}{XXX}{YY}
%
\item   \parbox[t]{0.55\linewidth}{\raggedright
What is your name? What is your name? What is your name? What is your name? What is your name? What is your name?
                                    }\hfill\D{8}{XXX}{YY}
\end{enumerate}

\lipsum[66]
\begin{enumerate}[resume]
\item   \begin{enumerate}
        \item   \parbox[t]{\dimexpr0.55\linewidth-0.5\leftmargin}{\raggedright
        What is your name?
                                         }\hfill\D{16}{XXX}{YY}
        \item   \parbox[t]{\dimexpr0.55\linewidth-0.5\leftmargin}{\raggedright
        What is your name?
                                          }\hfill\D{16}{XXX}{YY}
        \end{enumerate}
\end{enumerate}
%
\end{document}

在此处输入图片描述

(红线表示页面布局}

相关内容