## LaTeX forum ⇒ General ⇒ \acro - Hyper reference undefined - but not everywhere

LaTeX specific issues not fitting into one of the other forums of this category.
TomWrite
Posts: 5
Joined: Sun Oct 17, 2021 7:49 pm

### \acro - Hyper reference undefined - but not everywhere

Hello everyone,

I am facing a strange issue I am struggling with.

I am using \acro to define my acronyms. For about 90% it works. The list of acronyms is included and each acronym is a clickable link. However, for three (see below) this only throws an undefined error. Any idea what could be the problem?
I already deleted and rewrote the lines, I check spelling etc., nothing seems to solve it...

Anyone any idea?

Thanks
Tom

\usepackage{hyperref} % Clickable links
\usepackage[printonlyused]{acronym} %Abbreviations

\hypersetup{final}

\begin{document}
\begin{acronym}
%those work
\acro{DSG}{Datenschutzgesetz}
\acro{VDSG}{Verordnung zum Bundesgesetz über den Datenschutz}

% those throw an error about hyperlink not defined
\acro{revDSG}{revisioniertes Datenschutzgesetz}
\acro{ISG}{Informationssicherheitsgesetz}
\acro{BÜPF}{Bundesgesetz betreffend die Überwachung des Post- und Fernmeldeverkehrs}
\end{acronym}

Rechtlich
\begin{itemize}[leftmargin=*]
\item \ac{revDSG}
\item \ac{ISG}
\item \ac{DSG}
\item \ac{VDSG}
\item \ac{BÜPF}
\end{itemize}

\end{document}
Last edited by cgnieder on Fri Jan 14, 2022 8:14 pm, edited 1 time in total.
Reason: changed inline code markup to block

LaTeXguide.org • LaTeX-Cookbook.net

rais
Posts: 300
Joined: Sun Nov 16, 2014 8:51 pm

### \acro - Hyper reference undefined - but not everywhere

Well, after expanding your code to a minimal working example, I got only 1[1] warning:
pdfTeX warning (dest): name{B\\unhbox\040\\voidb@x\040\\bgroup\040\\let\040\\
unhbox\040\\voidb@x\040\\setbox\040\\@tempboxa\040\\hbox\040{U\\global\040\\mat
hchardef\040\\accent@spacefactor\040\\spacefactor\040}\\let\040\\begingroup\040
\\let\040\\typeout\040\\protect\040\\begingroup\040\\def\040\\MessageBreak\040{
\012$$Font$$\040\040\040\040\040\040\040\040\040\040\040\040\040\040}\\let\040\
\protect\040\\immediate\\write\040\\m@ne\040{LaTeX\040Font\040Info:\040\040\040
\040\040on\040input\040line\04026.}\\endgroup\040\\endgroup\040\\relax\040\\let
\040\\ignorespaces\040\\relax\040\\accent\040127\040U\\egroup\040\\spacefactor\
040\\accent@spacefactor\040PF} has been referenced but does not exist, replaced
by a fixed one
, not 3 errors.

acronym's \acro command creates some macros from its first argument. Though the package's way isn't as strict as, say, \newcommand, extended[2] characters---such as umlauts--- in the name for the macro(s) to be created present a problem.
For cases like this, \acro accepts an optional argument that can be used to put not-usable-characters-within-a-macro' into the short form. Then the first argument doesn't need this troublesome character (or more of them), anymore:
\documentclass{article}%<-- no class, no LaTeX
\usepackage{hyperref} % Clickable links
\usepackage[printonlyused]{acronym} %Abbreviations

%\hypersetup{final}%<-- isn't that default?

\begin{document}
\begin{acronym}
%those work
\acro{DSG}{Datenschutzgesetz}
\acro{VDSG}{Verordnung zum Bundesgesetz über den Datenschutz}

% those throw an error about hyperlink not defined
\acro{revDSG}{revisioniertes Datenschutzgesetz}
\acro{ISG}{Informationssicherheitsgesetz}
\acro{BUePF}[BÜPF]{Bundesgesetz betreffend die Überwachung des Post- und Fernmeldeverkehrs}%<--
\end{acronym}

Rechtlich
\begin{itemize}%[leftmargin=*]%<-- the standard itemize env has no such option
\item \ac{revDSG}
\item \ac{ISG}
\item \ac{DSG}
\item \ac{VDSG}
\item \ac{BUePF}
\end{itemize}

\end{document}


[1] ignoring over-/underfull stuff here
[2] for lack of a better word...think of it as character not to be used within a \csname...\endcsname'' construct

KR
Rainer

TomWrite
Posts: 5
Joined: Sun Oct 17, 2021 7:49 pm

### \acro - Hyper reference undefined - but not everywhere

Thanks Rainer, sorry about the missing code parts. Still not used to latex and all the stuff needed.

Main thing for me is not really an error during compile. This works quite fine. It try to attach a screenshot that shows the problem.

The compiled list of acronyms exists of clickable links. However for the three acros I listed this doesnt work.
Yet for all of them the code is the same.

So it is less an error but rather a problem with the compiled pdf, giving me different results for the same acro\ code.
Attachments
Screenshot 2022-01-15 at 08.37.54.png (63.08 KiB) Viewed 103 times

cgnieder
Site Moderator
Posts: 1996
Joined: Sat Apr 16, 2011 7:27 pm

### \acro - Hyper reference undefined - but not everywhere

site moderator & package author

Ijon Tichy
Posts: 614
Joined: Mon Dec 24, 2018 10:12 am

### \acro - Hyper reference undefined - but not everywhere

rais has explained why this is and shown what to do. Have you tested his changes to your code?

BTW: You can avoid the problem using LuaLaTeX instead of PDFLaTeX, because LuaLaTeX is UTF8 native.
%!TeX LuaLaTeX
\documentclass{article}% ADDED to make a MWE
\usepackage{enumitem}% ADDED to make a MWE
\usepackage{hyperref} % Clickable links
\usepackage[printonlyused]{acronym} %Abbreviations

\hypersetup{final}

\begin{document}
\begin{acronym}
%those work
\acro{DSG}{Datenschutzgesetz}
\acro{VDSG}{Verordnung zum Bundesgesetz über den Datenschutz}

% those throw an error about hyperlink not defined
\acro{revDSG}{revisioniertes Datenschutzgesetz}
\acro{ISG}{Informationssicherheitsgesetz}
\acro{BÜPF}{Bundesgesetz betreffend die Überwachung des Post- und Fernmeldeverkehrs}
\end{acronym}

Rechtlich
\begin{itemize}[leftmargin=*]
\item \ac{revDSG}
\item \ac{ISG}
\item \ac{DSG}
\item \ac{VDSG}
\item \ac{BÜPF}
\end{itemize}

\end{document}


TomWrite
Posts: 5
Joined: Sun Oct 17, 2021 7:49 pm

### \acro - Hyper reference undefined - but not everywhere

Thx Ijon, TBH I have no idea what exactly rais was talking about. I see the point with the german umlaut.

But, those two dont have an umlaut and they dont work either:
\acro{revDSG}{revisioniertes Datenschutzgesetz}\acro{ISG}{Informationssicherheitsgesetz}

and even when I use \acro{BUePF}[BÜPF]{Bundesgesetz betreffend die Überwachung des Post- und Fernmeldeverkehrs}%<-- it doesnt work.

The hyperref link isnt created in the list of acronyms. However, something I might wrote not clear enough, the acronyms do work in the text. It is that the list of acronyms isnt build correctly.

What is it that I am missing?

Summary, 4 acronyms, none with an umlaut. 2 work and create a clickable hyperref link in the list of acronyms, 2 with exact same code dont. (see screenshot former post)
%those work\acro{DSG}{Datenschutzgesetz}\acro{VDSG}{Verordnung zum Bundesgesetz über den Datenschutz}% those dont work. \acro{revDSG}{revisioniertes Datenschutzgesetz}\acro{ISG}{Informationssicherheitsgesetz}

PS: LuaLaTex doesnt change the behaviour

Ijon Tichy
Posts: 614
Joined: Mon Dec 24, 2018 10:12 am

### \acro - Hyper reference undefined - but not everywhere

In rais' code in in my code all these entries do work. You can test it, using the Run latex here` button below the code.

So if these entries do not work in your document, there must be something, you've not yet told us. Please show us a minimal working example that really can be used to reproduce the problem. We cannot help, if you keep something relevant from us.

BTW: Please use the code button/tag for code blocks. The LaTeX button/tag is for inline code only. And please always try to show a complete minimal working example, not only a code snippet to illustrate your problem.