我正在使用考试包编写练习,我注意到问题标题、文本和各部分的缩进不同。如何让所有内容都正确无误?
\documentclass[french,a4paper,addpoints,11pt]{exam}
\usepackage[a4paper, total={165mm,250mm}]{geometry}
\usepackage{lipsum}
\qformat{\textbf{Exercise \thequestion}\hfill}
\begin{document}
\begin{questions}
\question
\lipsum[1]
\begin{parts}
\part \lipsum[2]
\answerline[42]
\part \lipsum[3]
\begin{checkboxes}
\choice Foo
\choice Bar
\CorrectChoice Baz
\end{checkboxes}
\end{parts}
\end{questions}
\end{document}
如何至少删除练习标题和文本之间的间距?
答案1
您可以使用该类提供的钩子,参见其文档,第 4.10 节。
\documentclass[french,a4paper,addpoints,11pt]{exam}
\usepackage[a4paper, total={165mm,250mm}]{geometry}
\usepackage{lipsum}
\qformat{\textbf{Exercise \thequestion}\hfill}
% code added vvv
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}
\renewcommand{\partshook}{%
\renewcommand\makelabel[1]{\rlap{##1}\hss}% this line is from https://tex.stackexchange.com/a/285767/101651
\setlength{\leftmargin}{\itemindent}%
\addtolength{\leftmargin}{\labelwidth}%
\addtolength{\leftmargin}{\labelsep}%
}
\renewcommand{\checkboxeshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}
% code added ^^^
\begin{document}
\begin{questions}
\question
\lipsum[1]
\begin{parts}
\part \lipsum[2]
\answerline[42]
\part \lipsum[3]
\begin{checkboxes}
\choice Foo
\choice Bar
\CorrectChoice Baz
\end{checkboxes}
\end{parts}
\end{questions}
\end{document}