3

I am using the acronym package (in classicthesis) and am trying to selectively change the colour of the hyperlinks of the acronym full names in the acronym list while preserving the standard hyperlink colour set in hyperref for both the acronyms in the acronym list, as well as the in-text acronym instances. I would thus like to avoid the visual experience of an entire page of coloured text for the acronym list.

Similar questions have been asked and answered in Acronym hyperlink without special color and in in classicthesis, change acronym hyperlink colour (to black) but leave crosslinks blue.

However, the answers only seem to remove the colour of the in-text acronym hyperlinks while leaving the colour of the short form and full name hyperlinks in the acronym list unchanged.

I would like to avoid having to use the acronym option 'nohyperlinks' which would remove the colours at the cost of having no hyperlinks.

Here is the MWE:

\documentclass{article}
\usepackage{acronym}
\usepackage[colorlinks=true]{hyperref}

% This solution (see linked questions) only removes hyperlink colour from the
% in-text acronym, but not from the acronyms listed in the acronym environment
\makeatletter
\AtBeginDocument{%
  \renewcommand*{\AC@hyperlink}[2]{%
    \begingroup
      \hypersetup{hidelinks}%
      \hyperlink{#1}{#2}%
    \endgroup
  }%
}
\makeatother

\begin{document}

% in-text acronym
\ac{foo} and \ac{foo}

% acronym list in the acronym environment
\begin{acronym}
\acro{foo}[FB]{FooBar}
\end{acronym}

\end{document}

acronym MWE output

Again, in contrast to the above solution, I would like to only remove the hyperlink colour in the acronym list, ideally only of the full name (both acronym and full name uncoloured may also be fine).

Many thanks in advance!

2
  • Please provide a MWE so we can help you !
    – nlair
    Mar 25, 2021 at 11:06
  • you should provide a small but complete example, at best one which doesn't load classicthesis (which is quite a pain as it changes so many things). That would make it much easier to test solutions. Mar 25, 2021 at 11:07

1 Answer 1

0

I had exactly the same problem. Here is my hacky, but simple approach:

Inside the acronym environment, you can define a new command to control the text color where I need:

...
\begin{acronym}
  % Define a new command `blacro` to print the long form in black
  \newcommand{\blacro}[2]{\acro{#1}{\color{black}#2}}
  
  % Make sure to use the newly defined command
  \blacro{foo}[FB]{FooBar} 
\end{acronym}

This kind of decorates the original command by rendering the 2nd argument in the color that you want (I am using \color{black}). You can add another argument in order to define a more general command that works for any color.

I haven't tested it using your example, but it works for me in Classic Thesis.

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.