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

Postby TomWrite » Fri Jan 14, 2022 10:06 am

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

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
rais
Posts: 300
Joined: Sun Nov 16, 2014 8:51 pm

\acro - Hyper reference undefined - but not everywhere

Postby rais » Fri Jan 14, 2022 11:05 pm

Well, after expanding your code to a Infominimal 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

Postby TomWrite » Sat Jan 15, 2022 9:40 am

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
Screenshot 2022-01-15 at 08.37.54.png (63.08 KiB) Viewed 104 times

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

\acro - Hyper reference undefined - but not everywhere

Postby cgnieder » Sat Jan 15, 2022 12:10 pm

site moderator & package author

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

\acro - Hyper reference undefined - but not everywhere

Postby Ijon Tichy » Sat Jan 15, 2022 12:11 pm

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

Postby TomWrite » Sat Jan 15, 2022 1:49 pm

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

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

\acro - Hyper reference undefined - but not everywhere

Postby Ijon Tichy » Sat Jan 15, 2022 7:15 pm

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 Infominimal 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.


Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests