5

The following forces an error

\href{https://fr.wikipedia.org/wiki/Gouvernement_de_la_République_française}{France}

replacing or deleting the ç stops the error

Error reported:

! Illegal parameter number in definition of \Hy@tempa.

The preamble includes:

\usepackage[utf8]{inputenc}
\usepackage[unicode=true]{hyperref}

Anyone any suggestions or a workaround?

7

You need to load the fontenc package with the option T1. (The default is still OT1.) In contrast it shouldn't be necessary to load the inputenc package with the option utf8 unless your LaTeX format isn't fully up to date. (LaTeX formats since 2018-04-01 are OK.)

\documentclass{article}
% \usepackage[utf8]{inputenc}  % not unless LaTeX format isn't up to date
\usepackage[T1]{fontenc}  % <-- this one matters
\usepackage[spaces,obeyspaces,hyphens]{url} % optional
\usepackage[colorlinks]{hyperref}

\begin{document}

\href{https://fr.wikipedia.org/wiki/Gouvernement_de_la_République_française}{France}

\end{document}
1

Wrapping the url in \detokenise{} does the job

\href{\detokenize{https://fr.wikipedia.org/wiki/Gouvernement_de_la_République_française}}{France}

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.