Latex 考試類別:考試類別「solutionorlines」環境的自訂線寬

Latex 考試類別:考試類別「solutionorlines」環境的自訂線寬

我正在使用乳膠考試課程的“solutionorlines”環境來解決簡短的問題(帶有解決方案),它提供了答案。以下程式碼為我提供了跨越頁面整個寬度的答案行。我想控制這些線的寬度,以便我可以根據我的選擇(1 英寸、2 英寸等)減少它們。由於我已經寫了很多問題,因此如果能有一個文檔範圍的解決方案就好了。

\documentclass{exam}
%\printanswers
\begin{document}

\begin{questions}
    \question List down three alphabets.
    \begin{solutionorlines}[3cm]
    \begin{enumerate}
          \item a
          \item b
          \item c 
        \end{enumerate}
    \end{solutionorlines}
\end{questions}

\end{document}

例如,這是我使用現有程式碼得到的結果: 在此輸入影像描述

而我想要以下內容:

在此輸入影像描述

答案1

您可以重新定義\linefill巨集(不知道考試課程是否也將其用於其他用途,因此使用風險自負):

\documentclass{exam}
%\printanswers

\renewcommand\linefill{\leavevmode\rule{.4\textwidth}{\linefillthickness}}

\begin{document}

\begin{questions}
    \question List down three alphabets.
    \begin{solutionorlines}[3cm]
    \begin{enumerate}
          \item a
          \item b
          \item c 
        \end{enumerate}
    \end{solutionorlines}
\end{questions}

\begin{questions}
    \question List down three alphabets.
    \renewcommand\linefill{\leavevmode\rule{.8\textwidth}{\linefillthickness}}
    \begin{solutionorlines}[3cm]
    \begin{enumerate}
          \item a
          \item b
          \item c 
        \end{enumerate}
    \end{solutionorlines}
\end{questions}

\begin{questions}
    \question List down three alphabets.
    \begin{solutionorlines}[3cm]
    \begin{enumerate}
          \item a
          \item b
          \item c 
        \end{enumerate}
    \end{solutionorlines}
\end{questions}

\end{document}

在此輸入影像描述

答案2

最簡單的解決方案是將問題放在小頁面中。

\documentclass{exam}
%\printanswers
\begin{document}

\begin{questions}
  
  \begin{minipage}{2in}
    \question List down three alphabets.\\
    \begin{solutionorlines}[3cm]
      \begin{enumerate}
          \item with a very long line of text
          \item b
          \item c 
      \end{enumerate}
    \end{solutionorlines}
  \end{minipage}
\end{questions}

\end{document}

相關內容