0

I'm writing my thesis and I'm trying to print the list of acronyms. However, for those that I only call their short form (e.g. CPU), the hyperlink does not show in color. For the ones that are called "normally" i.e. their long form, the acronym is displayed correctly.

This is what I'm trying to do

\documentclass{book}

\usepackage{hyperref}
\usepackage[usenames,dvipsnames,table,xcdraw]{xcolor}

\hypersetup{
    bookmarksnumbered=true,
    plainpages=false, 
    pdfborder={0 0 0},
    colorlinks,
    breaklinks=true,
    linkcolor=Sepia,
    urlcolor=NavyBlue,
    citecolor=Sepia,
}

\usepackage[printonlyused]{acronym}

\newcommand*\acronymname{Acronyms}
\newcommand*\acronymbiggest{zk-SNARK}
\newcommand*\acronymfile{acros.tex}

\def\printacronyms{%
  \chapter*{\acronymname}
  \begin{acronym}[\acronymbiggest] % the biggest acronym
    \input{\acronymfile}
  \end{acronym}
}

\title{}
\author{}
\date{}

\begin{document}

\printacronyms

Test

% \acf{CPU} % => The hyperlink is colored
% \acs{CPU} % => The hyperlink is NOT colored

\end{document}

In the acros.tex file, I have this line \acro{CPU}{Central Processing Unit}.

Does any one know how I can fix this? Thanks in advance

1 Answer 1

1

acronym creates a link from the list to the "main" use of the acronym. If you use only the short version it has no idea which one to use. You can choose one of your uses as a target and place the label manually:

\documentclass{book}

\usepackage{hyperref}
\usepackage{xcolor}

\hypersetup{colorlinks}

\usepackage[printonlyused]{acronym}

\makeatletter 
\newcommand\ACplacelabel{\AC@placelabel}
\makeatother
\begin{document}

\begin{acronym}[MWE]
 \acro{CPU}{Central Processing Unit} %linked
 \acro{MWE}{Minimal Working Example} %no link
\end{acronym}

 \acs{MWE}

 \ACplacelabel{CPU}\acs{CPU} %

\end{document}

enter image description here

You must log in to answer this question.

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