我正在使用exam
课堂来准备问题库,并且我想在问题的末尾标记问题的来源(即我从哪里获取的)。
如何实现这一点?
梅威瑟:
\documentclass[11pt,a4paper,addpoints]{exam}
\renewcommand{\baselinestretch}{1.1}
\oddsidemargin 0in \evensidemargin 0in \topmargin 0in \textheight
9.2in \textwidth 6.5in
%\hoffset -1in
%\voffset -1in
%\evensidemargin 14pt
\usepackage{amsmath,amsthm,amsfonts,amssymb,tikz,}
%%%---------------For Title drop
\usepackage{,titling}
\setlength{\droptitle}{-1in}
\posttitle{\par\end{center}}
\pagestyle{headandfoot}
\rfoot{\iflastpage{}{\thepage}}
\cfoot{\iflastpage{$\maltese\maltese\maltese \maltese
\maltese$}{}}
\pointsinrightmargin
% command name
\newcommand{\cn}[1]{{\protect\ntt\bslash#1}}
\hfuzz1pc % Don't bother to report overfull boxes if overage is < 1pc
\newbox\allanswers
\setbox\allanswers=\vbox{}
\newenvironment{answer}
{%
\global\setbox\allanswers=\vbox\bgroup
\unvbox\allanswers
}%
{%
\bigbreak
\egroup
}
\newcommand{\showallanswers}{\twocolumn{
\begin{center}
\large{\textbf{Question Bank\\ Answer key\\\hrule height 1pt}}
\end{center} \par\unvbox\allanswers}}
\newcommand*{\getanswer}[5]{%
\ifthenelse{\equal{#5}{a}}
{\begin{answer}\thequestion. (a)~#1\end{answer}}
{\ifthenelse{\equal{#5}{b}}
{\begin{answer}\thequestion. (b)~#2\end{answer}}
{\ifthenelse{\equal{#5}{c}}
{\begin{answer}\thequestion. (c)~#3\end{answer}}
{\ifthenelse{\equal{#5}{d}}
{\begin{answer}\thequestion. (d)~#4\end{answer}}
{\begin{answer}\textbf{\thequestion. (#5)~Invalid answer
choice.}\end{answer}}}}}
}
\setlength\parindent{0pt}
%usage \choice{ }{ }{ }{ }
%(A)(B)(C)(D)
\newcommand{\fourch}[5]{
\par
\begin{tabular}{*{4}{@{}p{0.23\textwidth}}}
(a)~#1 & (b)~#2 & (c)~#3 & (d)~#4
\end{tabular}
\getanswer{#1}{#2}{#3}{#4}{#5}
}
%(A)(B)
%(C)(D)
\newcommand{\twoch}[5]{
\par
\begin{tabular}{*{2}{@{}p{0.46\textwidth}}}
(a)~#1 & (b)~#2
\end{tabular}
\par
\begin{tabular}{*{2}{@{}p{0.46\textwidth}}}
(c)~#3 & (d)~#4
\end{tabular}
\getanswer{#1}{#2}{#3}{#4}{#5}
}
%(A)
%(B)
%(C)
%(D)
\newcommand{\onech}[5]{
\par
(a)~#1 \par (b)~#2 \par (c)~#3 \par (d)~#4
\getanswer{#1}{#2}{#3}{#4}{#5}
}
\newlength\widthcha
\newlength\widthchb
\newlength\widthchc
\newlength\widthchd
\newlength\widthch
\newlength\tabmaxwidth
\setlength\tabmaxwidth{0.96\textwidth}
\newlength\fourthtabwidth
\setlength\fourthtabwidth{0.25\textwidth}
\newlength\halftabwidth
\setlength\halftabwidth{0.5\textwidth}
\newcommand{\choice}[5]{%
\settowidth\widthcha{AM.#1}\setlength{\widthch}{\widthcha}%
\settowidth\widthchb{BM.#2}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchb{CM.#3}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchb{DM.#4}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\ifdim\widthch<\fourthtabwidth
\fourch{#1}{#2}{#3}{#4}{#5}
\else\ifdim\widthch<\halftabwidth
\ifdim\widthch>\fourthtabwidth
\twoch{#1}{#2}{#3}{#4}{#5}
\else
\onech{#1}{#2}{#3}{#4}{#5}
\fi\fi\fi}
%\renewcommand{\questionlabel}{}
%\renewcommand\partlabel{\Alph{partno}.}
\makeatletter
\def\vhrulefill#1{\leavevmode\leaders\hrule\@height#1\hfill \kern\z@}
\makeatother
\begin{document}
\begin{center}
\large{\textbf{Question Bank} }
\end{center}
\section{Linear Algebra}
\begin{questions}
\question[MU2017] What are all the subspaces of $\mathbb{R},\mathbb{R}^2,\mathbb{R}^3$?
\question Which of the following matrix is/are diagonalizable?
\choice{$\left(\begin{array}{cc}
1&0\\
0&1
\end{array}\right)$
}{$\left(\begin{array}{cc}
1&1\\
0&1
\end{array}\right)$}{$\left(\begin{array}{cc}
1&1\\
1&0
\end{array}\right)$}{$\left(\begin{array}{cc}
1&1\\
1&1
\end{array}\right)$}{×}
\question[NEST2015] There are 10 black balls in a box. A person picks 5 balls from the box, paints them white
and puts them back into the box. Now the person picks 5 balls from the box at random. The
probability that exactly 3 of these 5 balls are white is
\choice{$\frac{25}{126}$}
{$\frac{3}{10}$}
{$\frac{25}{63}$}
{$\frac{50}{63}$}{c}
\question[NEST2015] For three arbitrary real numbers $ r, s, t $ the mathematical identity is
\choice{ $(\min\{r,s,t\})^3 = \min \{ r^3, s^3, t^3\}$}
{ $(\min\{r,s,t\})^2 = \min \{ r^2, s^2, t^2\}$}
{ $|\min\{r,s,t\}| = \min \{ |r|, |s|, |t|\}$}
{$\sin(\min{r, s, t}) = \min{\sin r, \sin s, \sin t}$} {a}
\question
%\vskip 1in \centering{\large\decotwo\decofourleft\floweroneright $~~All ~~The~~ Best~~$\floweroneleft\decofourright\decotwo}
\end{questions}
\showallanswers % Phil Hirschorn
%\setcounter{page}{1}
%\cfoot{\iflastpage{$\maltese\maltese\maltese \maltese \maltese$}{\thepage}} \rfoot{}
\end{document}
- 无论我在点处写了什么文本(例如
\question[NEST2015]
),都会在问题上方打印相同的内容约 5 次。 - 而且,如果我
text
在第一个问题中包含一些而不是数字,我就会收到错误。
出了点问题——可能缺少了 \item。\question W