优化考试课堂中的居中答案

优化考试课堂中的居中答案

我正在准备一个多项选择考试模板,主要用于\oneparchoices考试课。我想改变\oneparchoices(或使用任何其他方法),以便答案始终出现在三行中(使用 MWE 会更清晰)。使用之前讨论中给出的建议“考试课堂中答案的集中“,我做了一些工作:

\documentclass[noaddpoints,12pt]{exam}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgf}
\footer{}{\thepage}{}
\usepackage{graphicx}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\setlength{\multicolsep}{1.2em}
\usepackage{color}
\usepackage{wrapfig}
\setlength{\columnseprule}{0.5pt}
\def\columnseprulecolor{\color{black}}
\usepackage{tasks}

\newenvironment{oneparchoicescentering}{
 \begingroup
 \leftskip=-0cm plus .5fil%                                                                                                                                                                           
 \rightskip=0cm plus -.5fil%                                                                                                                                                                          
 \parfillskip=0cm plus 1fil\relax
 \begin{oneparchoices}
}{
 \end{oneparchoices}
 \par
 \endgroup
}
\begin{document}
\noindent\framebox[\textwidth][s]{Test No: 001\hfill Topic: Elements}
\begin{multicols}{2}
\begin{questions}

\noindent\begin{minipage}{\linewidth}
\question Which one of the entries does not fit with the others?

\begin{oneparchoicescentering}
    \CorrectChoice $\frac{\frac{1}{2}+1}{2+\pi}+1$
    \choice $\sqrt{3\pi}$
    \choice $e^x$
    \choice Text
    \choice $\int xdx$
\end{oneparchoicescentering}
\vspace{3cm}
\end{minipage}

\noindent\begin{minipage}{\linewidth}
\question Which one of the entries does not fit with the others?

\begin{oneparchoicescentering}
    \CorrectChoice aaaaaaaaaa
    \choice bbbbbbbbbb
    \choice cccccccccc
    \choice dddddddddd
    \choice eeeeeeeeee
\end{oneparchoicescentering}
\vspace{3cm}
\end{minipage}
\end{questions}
\end{multicols}
\end{document}

结果是: 在此处输入图片描述

现在,我想做出以下更改:

  1. 如您所见,根据答案的长度,它们会出现两行或三行。我的目的是让答案始终排成三行(如 MWE 的第二个问题),我该怎么做?
  2. 数学项(尤其是分数)看起来太小了。有什么方法可以避免这种情况吗?(可能需要增加答案行之间的垂直间距。)
  3. 在 MWE 的第二道题中,选项 B 和选项 D 不一致。我该如何避免这种情况?(我相信解决我的第一个问题也会解决这个问题,但我想提一下。)

提前感谢您,干杯。

答案1

这就是我所能得到的。问题是答案不是的参数\choice\CorrectChoice将答案放入一个组中,并依赖于下一个\choice\end{oneparchoice}添加\endgroup,并且不清楚该组的作用。

无论如何,这显示了实现您想要的丑陋方法。我从段落的第一行中删除了惩罚以对齐列。也许其他人可以想出一种方法将 合并到和\makebox中。\choice\CorrectChoice

\documentclass[noaddpoints,12pt]{exam}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgf}
\footer{}{\thepage}{}
\usepackage{graphicx}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\setlength{\multicolsep}{1.2em}
\usepackage{color}
\usepackage{wrapfig}
\setlength{\columnseprule}{0.5pt}
\def\columnseprulecolor{\color{black}}
\usepackage{tasks}

\makeatletter
\renewenvironment{oneparchoices}%
  {%
    \setcounter{choice}{0}%
    \def\choice{%
      \if@correctchoice \endgroup \fi
      \refstepcounter{choice}%
      \ifnum\value{choice}>1\relax
        %\penalty -50\hskip 1em plus 1em\relax
      \fi
      \choicelabel
      % No need to put the following into a token string; we just put
      % the choicelabel onto the page, so we're at the spot whose page
      % number we want to record:
      \questionobject@pluspagecheck
      \nobreak\enskip
    }% choice
    \def\CorrectChoice{%
      \if@correctchoice \endgroup \fi
      \refstepcounter{choice}%
      \ifprintanswers
        \begingroup \@correctchoicetrue 
        \CorrectChoice@Emphasis
      \fi
      \ifnum\value{choice}>1\relax
        %\penalty -50\hskip 1em plus 1em\relax
      \fi
      \choicelabel
      % No need to put the following into a token string; we just put
      % the choicelabel onto the page, so we're at the spot whose page
      % number we want to record:
      \questionobject@pluspagecheck
      \nobreak\enskip
    }% CorrectChoice
    \let\correctchoice\CorrectChoice
    \let\par\@empty
    % If we're continuing the paragraph containing the question,
    % then leave a bit of space before the first choice:
    \ifvmode\else\enskip\fi
    \ignorespaces
  }%
  {\if@correctchoice \endgroup \fi}
\makeatother

\begin{document}
\noindent\framebox[\textwidth][s]{Test No: 001\hfill Topic: Elements}
\begin{multicols}{2}
\begin{questions}

\question Which one of the entries does not fit with the others?

\begin{oneparchoices}
    \makebox[0.5\linewidth][l]{\CorrectChoice $\dfrac{\frac{1}{2}+1}{2+\pi}+1$}
    \makebox[0.5\linewidth][l]{\choice $\sqrt{3\pi}$}
    \makebox[0.5\linewidth][l]{\choice $e^x$}
    \makebox[0.5\linewidth][l]{\choice Text}
    \makebox[0.5\linewidth][l]{\choice $\int xdx$}
\end{oneparchoices}
\vspace{3cm}
\question Which one of the entries does not fit with the others?

\begin{oneparchoices}
    \makebox[0.5\linewidth][l]{\CorrectChoice aaaaaaaaaa}
    \makebox[0.5\linewidth][l]{\choice bbbbbbbbbb}
    \makebox[0.5\linewidth][l]{\choice cccccccccc}
    \makebox[0.5\linewidth][l]{\choice dddddddddd}
    \makebox[0.5\linewidth][l]{\choice eeeeeeeeee}
\end{oneparchoices}
\vspace{3cm}
\end{questions}
\end{multicols}
\end{document}

演示


美在旁观者的眼中。

\documentclass[noaddpoints,12pt]{exam}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgf}
\footer{}{\thepage}{}
\usepackage{graphicx}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\setlength{\multicolsep}{1.2em}
\usepackage{color}
\usepackage{wrapfig}
\setlength{\columnseprule}{0.5pt}
\def\columnseprulecolor{\color{black}}
\usepackage{tasks}

\makeatletter
\renewenvironment{oneparchoices}%
  {%
    \setcounter{choice}{0}%
    \def\choice{%
      \if@correctchoice \endgroup \fi
      \refstepcounter{choice}%
      \ifnum\value{choice}>1\relax
        %\penalty -50\hskip 1em plus 1em\relax
      \fi
      \choicelabel
      % No need to put the following into a token string; we just put
      % the choicelabel onto the page, so we're at the spot whose page
      % number we want to record:
      \questionobject@pluspagecheck
      \nobreak\enskip
    }% choice
    \def\CorrectChoice{%
      \if@correctchoice \endgroup \fi
      \refstepcounter{choice}%
      \ifprintanswers
        \begingroup \@correctchoicetrue 
        \CorrectChoice@Emphasis
      \fi
      \ifnum\value{choice}>1\relax
        %\penalty -50\hskip 1em plus 1em\relax
      \fi
      \choicelabel
      % No need to put the following into a token string; we just put
      % the choicelabel onto the page, so we're at the spot whose page
      % number we want to record:
      \questionobject@pluspagecheck
      \nobreak\enskip
    }% CorrectChoice
    \let\correctchoice\CorrectChoice
    \let\par\@empty
    % If we're continuing the paragraph containing the question,
    % then leave a bit of space before the first choice:
    \ifvmode\else\enskip\fi
    \ignorespaces
  }%
  {\if@correctchoice \endgroup \fi}
\makeatother

\begin{document}
\noindent\framebox[\textwidth][s]{Test No: 001\hfill Topic: Elements}
\begin{multicols}{2}
\begin{questions}

\question Which one of the entries does not fit with the others?

\begin{oneparchoices}
    \makebox[0.5\linewidth][l]{\CorrectChoice $\dfrac{\frac{1}{2}+1}{2+\pi}+1$}
    \makebox[0.5\linewidth][r]{\choice $\sqrt{3\pi}$}
    \makebox[0.5\linewidth][l]{\choice $e^x$}
    \makebox[0.5\linewidth][r]{\choice Text}
    \makebox[\linewidth][c]{\choice $\int xdx$}
\end{oneparchoices}
\vspace{3cm}
\question Which one of the entries does not fit with the others?

\begin{oneparchoices}
    \makebox[0.5\linewidth][l]{\CorrectChoice aaaaaaaaaa}
    \makebox[0.5\linewidth][r]{\choice bbbbbbbbbb}
    \makebox[0.5\linewidth][l]{\choice cccccccccc}
    \makebox[0.5\linewidth][r]{\choice dddddddddd}
    \makebox[\linewidth][c]{\choice eeeeeeeeee}
\end{oneparchoices}
\vspace{3cm}
\end{questions}
\end{multicols}
\end{document}

演示

相关内容