更改考试类别中多列选项的“topsep”

更改考试类别中多列选项的“topsep”

我试图让我的问题选择如下:

1. Question ....
   (A) choice ....                                 (B) choice ....
   (C) choice ....                                 (D) choice ....
   (E) choice ....

但是,如果我使用这个答案,问题和选项(A)之间的空间与环境中的默认值\question和默认值不同。\choicequestions类似问题,但 documentclass 不同。另外,我希望按 (A)(B)(C)(D)(E) 顺序排列选项(如上所示),而不是 (A)(D)(B)(E)(C)(下面的示例问题 1)。

这是我的 MWE

\documentclass[11pt, a4paper, addpoints]{exam}
\usepackage[top=1.2in, bottom=1.2in, left=1.23in, right=1.23in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[utf8x]{inputenc}
\usepackage{enumitem}
\usepackage{ragged2e}
\usepackage{multicol}

\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{20pt}%
}

\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{18pt}%
}

\renewcommand{\checkboxeshook}{%
    \setlength{\leftmargin}{18pt}%
}

\renewcommand\choicelabel{(\Alph{choice})}
\renewcommand{\thepartno}{\arabic{partno}}

\newlist{choicesnew}{enumerate}{1}
\setlist[choicesnew]{label*=(\Alph*), topsep=0pt}
\newcommand{\choicenew}{\item}

\setlength\columnsep{40pt}

\SetEnumitemKey{twocol}{
  before=\raggedcolumns\begin{multicols}{2},
  after=\end{multicols}}

\SetEnumitemKey{threecol}{
  before=\raggedcolumns\begin{multicols}{3},
  after=\end{multicols}}

\begin{document}
\justifying
\pointsinrightmargin

\pointpoints{\%}{\%}

\begin{questions}
\question Example Question 1

\begin{choicesnew}[twocol]
\choicenew Answer 1
\choicenew Answer 2
\choicenew Answer 3
\choicenew Answer 4
\choicenew Answer 5
\end{choicesnew}

\question Example Question 2

\begin{choices}
\choice Answer 1
\choice Answer 2
\choice Answer 3
\choice Answer 4
\choice Answer 5
\end{choices}

\end{questions}
\end{document}

在此处输入图片描述

答案1

这显示了一个\makebox版本。它使用小页面而不是列表。因此,它不会分页。它也不会处理正确的选择或打印答案选项(工作量太大)。

\documentclass[11pt, a4paper, addpoints]{exam}
\usepackage[top=1.2in, bottom=1.2in, left=1.23in, right=1.23in, showframe]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[utf8x]{inputenc}
\usepackage{ragged2e}

% udbox is a \vbox version of lrbox
\makeatletter
\def\udbox#1{%
  \edef\reserved@a{%
  \endgroup
  \setbox#1\vbox{%
  \begingroup\aftergroup}%
  \def\noexpand\@currenvir{\@currenvir}%
  \def\noexpand\@currenvline{\on@line}}%
  \reserved@a
  \@endpefalse
  \color@setgroup
  \ignorespaces}
\def\endudbox{\unskip\color@endgroup}

\newenvironment{shortchoices}[1][2]{% #1 = number of columns
  \count1=#1\relax
  \settowidth{\labelwidth}{W.\hskip\labelsep}%
  \setlength{\leftmargin}{\dimexpr\labelsep+2.5em}%
  \setlength{\dimen0}{\dimexpr \linewidth-\leftmargin}% column width
  \ifnum\count1>0 \divide\dimen0 by \count1 \fi
  \advance\dimen0 by -\labelsep
  \begin{udbox}{0}% fill single solomn
    \@totalleftmargin=-2.5em
    \linewidth=\dimexpr \dimen0+2.5em\relax
    \choices}%
{\endchoices
  \end{udbox}% now shuffle contents
  \count2=0
  \loop\ifvoid0 \else
    \ifnum\count2=0
      \par\noindent\hskip 2.5em
    \fi
    \setbox1=\vsplit0 to \baselineskip
    \setbox2=\vbox{\unvbox1}% restore height
    \usebox2\hskip\labelsep
    \advance\count2 by 1
    \ifnum\count2=\count1
      \count2=0
    \fi
  \repeat
  \par\medskip
}
\makeatother

\begin{document}
\justifying
\pointsinrightmargin

\pointpoints{\%}{\%}

\begin{questions}
\question Example Question 1

\begin{shortchoices}[3]
\choice Answer 1
\choice Answer 2
\choice Answer 3
\choice Answer 4
\choice Answer 5
\choice Answer 6
\choice Answer 7
\end{shortchoices}

\question Example Question 2

\begin{choices}
\choice Answer 1
\choice Answer 2
\choice Answer 3
\choice Answer 4
\choice Answer 5
\end{choices}

\end{questions}
\end{document}

相关内容