我想用這種縮排格式建立一個多項選擇問題
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
在您的 Latex 資料夾中找到您的「exam.cls」。
打開它,
\settowidth{\leftmargin}{W.\hskip\labelsep\hskip 2.5em}%
改成 \settowidth{\leftmargin}{W.\hskip\labelsep\hskip 0em}%
- 節省。