编译以下文档时:
\documentclass[11pt]{exam}
\usepackage{amsmath,amsbsy,amssymb,amsthm,cases,blkarray,mathrsfs,amsrefs,amsfonts,latexsym}
\usepackage{enumerate,enumitem,textcomp,stackengine,bbm}
\usepackage{setspace,xifthen,fullpage,ragged2e,multicol,multirow,makecell}
\usepackage[english]{babel}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}% see http://ctan.org/pkg/xcolor
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\definecolor{lightlightgray}{gray}{0.93}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkred}{rgb}{.7,0,0}
\definecolor{darkgreen}{rgb}{0,.6,0}
\definecolor{red}{rgb}{.98,0,0}
\usepackage{listings,acronym,bbding, pmboxdraw}
\usepackage{pgfplots,graphics,graphicx,longtable,sectsty}
\usepackage[colorlinks,pdfusetitle,urlcolor=darkblue,citecolor=darkblue,linkcolor=darkred,bookmarksnumbered,plainpages=false,pageanchor]{hyperref}
\usepackage{datetime}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{pstricks,pst-node,pst-tree,titlesec,extramarks,totcount}
\usepackage{pdfpages,bbding,grffile}
\usepackage{xspace,verbatim} % used to display code
\usepackage[inner=1.5cm,outer=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{silence}
\usepackage{cleveref}
\printanswers
\addpoints
% For the exam package
\newcommand{\qs}{\question[1\half]}
\newcommand{\ch}{\choice}
\newcommand{\cc}{\CorrectChoice}
\CorrectChoiceEmphasis{\slshape\color{OliveGreen}}
\renewcommand{\thechoice}{\alph{choice}}
\renewcommand{\choicelabel}{(\thechoice{})}
\pointpoints{mark}{marks}
\pointpoints{}{}
\hpword{Marks}
\newcommand{\al}{\alpha}
\newcommand{\si}{\sigma}
\newcommand{\ybar}{\bar{y}}
\newcommand{\xbar}{\bar{x}}
\begin{document}
\begin{questions}
\qs Which one
\vskip0.02in
\begin{choices}
\cc According
\ch For
\ch IF
\ch All
\end{choices}
\qs Based on
\vskip0.02in
\begin{choices}
\ch mou
\cc ske
\ch s
\ch un
\end{choices}
\qs Suppos
\vskip0.02in
\begin{oneparchoices}
\ch $0.67$
\cc $0.56$
\ch $0.48$
\ch $0.64$
\end{oneparchoices}
\qs You a
\vskip0.02in
\begin{oneparchoices}
\ch $-1/16$
\cc $-1/8$
\ch $-3/16$
\ch $-1/2$
\end{oneparchoices}
\end{questions}
\end{document}
我尝试过通过在其他地方搜索来找到摆脱此警告的方法,并且我读过 PDFTeX 目标……忽略和此处的另一个问题 pdfTeX 警告:具有相同标识符的目标已被使用,重复被忽略(奇怪的行为)。我得到的是这个警告“pdftex 警告(ext4):具有相同标识符(name{choice.1})的目标已被使用,重复被忽略”,它出现了 48 次以上,并且与已经发布的不同。我发现的所有内容都有 name{page.1} 或 name{theorem.1}
MWE(由 cfr 根据 Werner 的例子添加)
\documentclass{exam}
\usepackage{hyperref}
\printanswers
\addpoints
\begin{document}
\gradetable
\begin{questions}
\question[1\half]
Suppose
\begin{oneparchoices}
\choice $0.67$
\CorrectChoice $0.56$
\choice $0.48$
\choice $0.64$
\end{oneparchoices}
\question[1\half]
You a
\begin{oneparchoices}
\choice $-1/16$
\choice $-3/16$
\CorrectChoice $-1/8$
\choice $-1/2$
\end{oneparchoices}
\end{questions}
答案1
看来exam
与的兼容性较差hyperref
。
您只需添加 的定义\theHchoice
,这样hyperref
就会选择 而不是\thechoice
。使用\arabic{question}.\arabic{choice}
将确保标签唯一。
\documentclass{exam}
\usepackage{hyperref}
%% keep hyperref happy
\newcommand{\theHchoice}{\arabic{question}.\arabic{choice}}
\printanswers
\addpoints
\begin{document}
\gradetable
\begin{questions}
\question[1\half]
Suppose
\begin{oneparchoices}
\choice $0.67$
\CorrectChoice $0.56$
\choice $0.48$
\choice $0.64$
\end{oneparchoices}
\question[1\half]
You a
\begin{oneparchoices}
\choice $-1/16$
\choice $-3/16$
\CorrectChoice $-1/8$
\choice $-1/2$
\end{oneparchoices}
\end{questions}
\end{document}