
このインデント形式で複数選択問題を作成したい
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
では、documentclassでインデントを設定する正しい方法は何でしょうか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}%
- 保存。