6

when compiling the following document:

\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}

I have tried find ways to get rid of this warning by searching in other places and I have read PDFTeX destination … ignored and the other question in this place pdfTeX warning: destination with same identifier has been already used, duplicate ignored (weird behaviour). What I get is this warning "pdftex warning (ext4): destination with the same identifier (name{choice.1}) has been already used, duplicate ignored" which occurs more than 48 times and different from the one already posted. All what I found has name{page.1} or name{theorem.1}

MWE (added by cfr based on Werner's example)

\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}
  • 4
    Welcome to TeX.SE! Please, make your MWE shorter. Erase all packages and definition which are not related to your problem. Also search this site for similar question. – Zarko May 21 '16 at 19:39
  • 1
    The following paste is more minimal and replicates the behaviour: MWE – Werner May 21 '16 at 20:05
  • @Werner You don't even need that much .... Even mine could be further minimised, I think. – cfr May 21 '16 at 21:49
3

It seems that exam has poor compatibility with hyperref.

You just need to add a definition for \theHchoice, so hyperref will pick up this instead of \thechoice. Using \arabic{question}.\arabic{choice} will ensure a unique tag.

\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}
  • I get similar warnings for tables and figures when using both the float and hyperref packages. – AstroFloyd Sep 6 '17 at 10:38
  • @AstroFloyd Are you sure you're loading the packages in the correct order? hyperref should generally be loaded last, with a few exceptions, notably cleveref, but not float. In case the order is right, a full example is needed, in a fresh question. – egreg Sep 6 '17 at 10:43
  • You are absolutely correct, I loaded the two packages in the wrong order - thank you! Now that I am aware of these restrictions for hyperref, I found more info here: Which packages should be loaded after hyperref instead of before?. – AstroFloyd Sep 8 '17 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.