A few months ago egreg gave a wonderful answer to a question I had about a modified gradetable using the exam document class. More recently, after loading the hyperref package, I realized the hyperlinking to a question's location from the modified table was not preserved.

Perhaps it's easy for a more experienced user to tell why this is the case, but egreg's code is quite beyond me. I'm wondering whether or not there's a way to modify the following code to preserve hyperlinking of questions:


  \label{grading\thegrading @label}%

\tl_new:N \l__farlow_grading_tl
  \tl_clear:N \l__farlow_grading_tl
  \int_step_inline:nnnn { 1 } { 1 } { \getrefnumber{grading\thegrading @label} }
    \tl_put_right:Nn \l__farlow_grading_tl
      ##1 \vphantom{$\bigg|$} & & & \\ \hline
    | c |
    >{\hsize=0.5\hsize} X |
    >{\hsize=0.5\hsize} X |
    >{\hsize=2.0\hsize} X |
  Problem &
  \multicolumn{1}{c|}{Understood} &
  \multicolumn{1}{c|}{Confused} &
  \multicolumn{1}{c|}{Note} \\ \hline
  \tl_use:N \l__farlow_grading_tl




\question First question.

\question Second question.



This produces the following:

enter image description here

In the code above, I only notably modified egreg's original code by loading the hyperref package as well as got rid of two question environments. With what I have in mind, I only need one questions environment, but it would be ideal if the question numbers in the table hyperlinked to the appropriate numbered question in the document.

Is there a relatively easy way to modify egreg's code to accomplish this or is it largely a lost cause?

1 Answer 1


All you need to do is tell TeX that when it's making the table, instead of dropping numbers it should drop hyper links. So change this line:

  ##1 \vphantom{$\bigg|$} & & & \\ \hline


\ref{question@##1} \vphantom{$\bigg|$} & & & \\ \hline

That is the line which makes the blank table at the beggining of each environment. It loops through some labels that were set up and dumps them in the table. From doing some research in the package (namely seeing the definition of \process@question from the expansion of \question), there is a label set at each question called question@*number*. We replaced the numbers that egreg put in with these labels, and the hyperlinks are there.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .