如何在考试中仅打印答案?

如何在考试中仅打印答案?

使用 \printanswers,我可以打印每个问题后面的所有答案。现在我想只打印答案而不打印问题。我需要这个,因为我只想上传答案,而不是网站上的问题。

\documentclass[11pt,oneside,A4paper,final,leqno]{exam}
\usepackage{tikz}
\usepackage{enumerate}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{xcolor}
\renewcommand{\sectionmark}[1]{  {\markright{\rm \small\thesection.\ #1}}}
\usepackage[paper=a4paper,margin=1.086571in]{geometry}%
\usepackage{etex}

\usepackage[mathscr]{eucal}
\usepackage{graphics, graphpap}
\usepackage{multicol,color}
\usepackage{indentfirst}

\renewcommand{\thefootnote}{}



\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}

\usepackage[absolute,overlay]{textpos}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usepackage{amsthm}
\def\bi{\textbf{i}}
\def\bj{\textbf{j}}
\def\bk{\textbf{k}}


\usepackage[all]{xy} \SelectTips{eu}{}

\renewcommand\questionlabel{\thequestion.} %replace period with parenthesis
\renewcommand{\thequestion}{\bfseries \arabic{question}}
\printanswers
\begin{document}


\section*{Maths Test  \# 1901 \rule{5.92cm}{.4pt}
}




\begin{questions}



\question What is the probability of picking an ace in two consecutive attempts in a 52 card deck?
\begin{multicols}{4}
\begin{choices} 
\choice  $\displaystyle\frac{13}{221}$
\choice  $\displaystyle\frac{23}{221}$
\choice  $\displaystyle\frac{33}{221}$
\choice  $\displaystyle\frac{43}{221}$
\end{choices}  
\end{multicols}
\begin{solution} $(C)$.
In the first attempt, the chance not to get an ace is $48/52$. In the second one, the chance is $47/51$. Therefore, the chance not to get an ace in two consecutive attempts is $48*47/51*52=188/221$. Hence, the result must be $1-188/221=33/221$.
\end{solution}




\question Given three points $A(1,5), B(4,1)$ and $C(5,8)$. What is the angle $\widehat{ACB}$?
\begin{multicols}{4}
\begin{choices} 
\choice  $90$
\choice  $45$ %b
\choice  $60$
\choice  $120$
\end{choices}  
\end{multicols}
\begin{solution} $(B)$
We have $\overrightarrow{AB}=(3,-4)$ and $\overrightarrow{AC}=(4,3)$. Therefore, $ABC$ is an isosceles triangle with $\widehat{BAC}=90$. Thus, the answer is $\widehat{ACB}=45$.
\end{solution}

\question Suppose the ball moves freely inside the square domain with constant speed and the reflection off the boundary elastic and subject to a familiar law: the angle of incidence equals the angle of reflection. Put the ball at the center of the domain. At which angle $\alpha$ does the ball have to start so that it will hit one of the four corners of the domain?
\begin{center}

\begin{tikzpicture} 
\clip(-4.5,1.5) rectangle (2.5,8.5);
%\fill[line width=.4pt,fill=white] (2.,2.) -- (2.,8.) -- (-4.,8.) -- (-4.,2.) -- cycle;
\draw[line width=.4pt,color=black] (-0.6928530532823249,2.) -- (-0.6928530532823249,2.3071469467176757) -- (-1.,2.3071469467176757) -- (-1.,2.) -- cycle; 
\draw [shift={(-1.,5.)},line width=.6pt,color=black] (0,0) -- (270.:1) arc (270.:303.6900675259798:1) -- cycle;
\draw [line width=.6pt] (2.,2.)-- (2.,8.);
\draw [line width=.66pt] (2.,8.)-- (-4.,8.);
\draw [line width=.6pt] (-4.,8.)-- (-4.,2.);
\draw [line width=.6pt] (-4.,2.)-- (2.,2.);
\draw [line width=.6pt] (-1.,5.)-- (-1.,2.);
\draw [line width=.6pt] (-1.,5.)-- (1.,2.);
\begin{scriptsize}
\draw[] (-0.1,4.6081570530868605) node {$\alpha$};
\end{scriptsize}
\end{tikzpicture}
\end{center}


\begin{choices} 
\choice  $\displaystyle\tan{\alpha}=\frac{1}{2017}$
\choice  $\displaystyle\tan{\alpha}=\frac{1}{2018}$ %b
\choice  $\displaystyle\tan{\alpha}=\frac{2}{2019}$
\choice  $\displaystyle\tan{\alpha}=2020$
\end{choices}  


\end{questions}

 \end{document}

答案1

保护问题文本(以及可选的可能答案)。仅当\ifprintanswers为假时才显示它们:

\documentclass[11pt,oneside,A4paper,final,leqno]{exam}
\usepackage{tikz}
\usepackage{enumerate}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{xcolor}
\renewcommand{\sectionmark}[1]{{\markright{\rm \small\thesection.\ #1}}}
\usepackage[paper=a4paper,margin=1.086571in]{geometry}%
\usepackage{etex}

\usepackage[mathscr]{eucal}
\usepackage{graphics, graphpap}
\usepackage{multicol,color}
\usepackage{indentfirst}

\renewcommand{\thefootnote}{}

\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}

\usepackage[absolute,overlay]{textpos}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usepackage{amsthm}
\def\bi{\textbf{i}}
\def\bj{\textbf{j}}
\def\bk{\textbf{k}}

\usepackage[all]{xy} \SelectTips{eu}{}

\renewcommand\questionlabel{\thequestion.} %replace period with parenthesis
\renewcommand{\thequestion}{\bfseries\arabic{question}}
\printanswers%
\begin{document}

\section*{Maths Test  \# 1901 \rule{5.92cm}{.4pt}}
\begin{questions}
    \ifprintanswers\question\strut\newline\else\question%
        What is the probability of picking an ace in two consecutive attempts in a 52 card deck?
        \begin{multicols}{4}
            \begin{choices}
                \choice$\displaystyle\frac{13}{221}$
                \choice$\displaystyle\frac{23}{221}$
                \choice$\displaystyle\frac{33}{221}$
                \choice$\displaystyle\frac{43}{221}$
            \end{choices}
        \end{multicols}
    \fi
    \begin{solution} $(C)$.
        In the first attempt, the chance not to get an ace is $48/52$.
        In the second one, the chance is $47/51$.
        Therefore, the chance not to get an ace in two consecutive attempts is $48*47/51*52=188/221$.
        Hence, the result must be $1-188/221=33/221$.
    \end{solution}
\end{questions}
\end{document}

示例输出

相关内容