This is a follow-up question. A working example of highlighting the first reference in text can be found in

Highlight first occurence of reference in text

However, there is an open question on how to handle lists of references. For now, the answer neglects lists and does not keep track of their occurrence. I require highlighting the complete list and keeping track of the highlights as if the references were standalone. So if I say


I would get highlighted

Equations (1) to (3)

If I then reference to one of these equations again, they won't be highlighted as they were already highlighted in the list?

Thanks for your help and a happy new year to you all!

  • 2
    Off-topic: Using label names such as eq:1 etc. are not really useful; if the order of equation changes it's sometimes necessary to change the label names here as well. Use human readable label names, such as \label{eq:einsteinsenergyrelation} etc.
    – user31729
    Jan 2 '18 at 12:13
  • 1
    Regarding cleveref: There is a whole section (or chapter) about customizing the format (= highlighting) of the references, see section 8 of current cleveref documentation file
    – user31729
    Jan 2 '18 at 12:16
  • Hello, the numbers are only an example to shorten the question. I do not find any help in the cleverref documentation for changing the format of the first occurrence. Maybe you can specify the position were I find additional information?
    – Bernte
    Jan 2 '18 at 14:20

I found a way to make this thing working via xparse and splitlist. I parse the list and set the marginnotes by processing the comma separated list.

Here is the working solution for anyone interested:

  \ifcsname marginnote@#1\endcsname
  \expandafter\gdef\csname marginnote@#1\endcsname{}}
%Redefine \cref so that it will make a margin note if the passed label is referenced for the first time.
      \ifcsname creflnote@#1\endcsname%
        \expandafter\gdef\csname creflnote@#1\endcsname{}%
    %check if the label has already been referenced.
    \ifcsname marginnote@#1\endcsname
        %already exists...therefore not the first citation
        \expandafter\gdef\csname marginnote@#1\endcsname{}%first citation...with this defined, will not underline again

Have a nice day!

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.