在考試文檔類別中設定選擇的縮排

在考試文檔類別中設定選擇的縮排

我想用這種縮排格式建立一個多項選擇問題

1. ########
   A. ###
   B. ###
   C. ###
2. ########
   ########
   A. ###
   B. ###
   C. ###

選項與問題文字具有相同的縮排。

但是,使用預設的exam文檔類,我得到了這種格式

1. ########
     A. ###
     B. ###
     C. ###
2. ########
   ########
     A. ###
     B. ###
     C. ###

因此,我嘗試將 設為\leftmargin環境0pt內部choices以獲得我想要的東西。

\documentclass{exam}
\begin{document}
\begin{questions}
  \question
  How old are you?
  \begin{choices}
    \setlength{\leftmargin}{0pt}
    \choice 14
    \choice 17
    \choice 19
    \choice 20
    \choice 23
  \end{choices}
\end{questions}
\end{document}

但是,它無處可去。

choice那麼,在文檔類別中設定縮排的正確方法是什麼exam

答案1

遵循第 4.10 節exam文檔,我相信您正在尋找choiceshook,可以按如下方式使用,例如

\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{30pt}%
}
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{50pt}%
}

這是一個完整的 MWE-我加載了geometry包裝showframe=true僅用於演示。

% arara: pdflatex
% !arara: indent: {overwrite: true}
\documentclass{exam}
\usepackage[showframe=true]{geometry}

\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{30pt}%
}
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{50pt}%
}
\begin{document}
\begin{questions}
    \question
    How old are you?
    \begin{choices}
        \choice 14
        \choice 17
        \choice 19
        \choice 20
        \choice 23
    \end{choices}
\end{questions}
\end{document}

exam作為參考,這是文件中的引用

考試文檔類別定義如下:

\newcommand{\questionshook}{} 
\newcommand{\partshook}{}
\newcommand{\subpartshook}{} 
\newcommand{\subsubpartshook}{}
\newcommand{\choiceshook}{} 
\newcommand{\checkboxeshook}{} 

因此,預設情況下這些命令不起作用,但您可以使用 \renewcommand 命令更改其中任何命令。

答案2

試試這個看看

\uplevel{
\begin{choices}
    \choice 
    \choice 
    \choice 
    \choice 
\end{choices}}

答案3

  1. 在您的 Latex 資料夾中找到您的「exam.cls」。

  2. 打開它,

\settowidth{\leftmargin}{W.\hskip\labelsep\hskip 2.5em}% 改成 \settowidth{\leftmargin}{W.\hskip\labelsep\hskip 0em}%

  1. 節省。

相關內容