2

I wanna print the following link (https://commons.wikimedia.org/wiki/File:Eidgenössische_Abstimmung_über_die_Verminderung_von_Treibhausgasemissionen_2021.svg) in a latex beamer presentation.

Here is my example that leaves out the ö (using another template I got something else than the ö):

    \RequirePackage[hyphens]{url}
\documentclass[aspectratio=169,10pt]{beamer}

\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}

\title{Example Title} \author{Example Author} \institute{Example Inst} \date{\today}

\begin{document} \begin{frame}[fragile]{Example:}

\url{https://commons.wikimedia.org/wiki/File:Eidgenössische_Abstimmung_über_die_Verminderung_von_Treibhausgasemissionen_2021.svg} \end{frame} \end{document}

Mico
  • 506,678

1 Answers1

4

I experience no problems with the Umlauts when I (a) compile the document with LuaLaTeX and (b) reformulate your code to employ the xurl package instead of the url package, to allow the URL string to break anywhere (not just at hyphen characters).

enter image description here

\documentclass[aspectratio=169,10pt]{beamer}
\usepackage{xurl} % allow line breaks at arbitrary points in URL string
\usepackage{hyperref}

\begin{document} \begin{frame}{Example}

\url{https://commons.wikimedia.org/wiki/File:Eidgenössische_Abstimmung_über_die_Verminderung_von_Treibhausgasemissionen_2021.svg} \end{frame} \end{document}

Mico
  • 506,678
  • This is weird. Tried it in two different documents (both in overleaf) and never works for me :( (ok didn't use LuaLaTeX correctly) – canIchangethis Nov 28 '22 at 12:58
  • 2
    you should use a percent encoded url (split with \href). While many pdf viewers can handle url's with umlauts, they are actually not valid in a pdf and so not reliable. – Ulrike Fischer Nov 28 '22 at 14:12
  • Okay! If I use % in the urls it works, just hate changing things manually, as this is very error prone. – canIchangethis Nov 28 '22 at 15:58
  • @UlrikeFischer - Could you elaborate on the "url's with umlauts ... are ... reliable" comment? E.g., which pdf viewers may have trouble with such url strings? FWIW, Adobe Reader and Acrobat appear to handle the url in question just fine. – Mico Nov 28 '22 at 16:49
  • 2
    @Mico I don't know the current state, we run a number of tests around 1-2 years ago, and various viewers on mac failed. – Ulrike Fischer Nov 28 '22 at 17:04
  • 1
    @Mico For example mac Preview.app v. 11.0 fails. – samcarter_is_at_topanswers.xyz Nov 28 '22 at 19:34