防止问题中的第二行悬空

防止问题中的第二行悬空

如何防止第二行像以下示例中那样缩进?

\documentclass{exam}
\begin{document}
    \begin{questions}
        \setcounter{question}{100}
        \question This is a very very very very very very very very very very very very very very very very very very very very very long question
        \begin{choices}
            \choice one
            \choice two
        \end{choices} 
    \end{questions}
\end{document}

我希望第二行与“This”中的“T”水平对齐。

答案1

您必须调整\labelwidth使用\questionshook

\newlength{\mylen}
\settowidth{\mylen}{9999}
\renewcommand{\questionshook}{%
        \setlength{\leftmargin}{0pt}%
        \setlength{\labelwidth}{\mylen}%
   }

完整代码:

\documentclass{exam}
\newlength{\mylen}
\settowidth{\mylen}{9999}
\renewcommand{\questionshook}{%
        \setlength{\leftmargin}{0pt}%
        \setlength{\labelwidth}{\mylen}%
 }

\begin{document}
    \begin{questions}
        \question This is a very very very very very very very very very very very very very very very very very very very very very long question
        \begin{choices}
            \choice one
            \choice two
        \end{choices}
        \setcounter{question}{100}
        \question This is a very very very very very very very very very very very very very very very very very very very very very long question
        \begin{choices}
            \choice one
            \choice two
        \end{choices}
    \end{questions}
\end{document}

在此处输入图片描述

相关内容