hyperref
hyperref copied to clipboard
\hyperbaseurl doesn't work correctly
One would expect to be able to change the baseurl locally with it. But this doesn't work.
\documentclass[12pt,a4paper]{article}
\usepackage{l3pdf}
\ExplSyntaxOn
\pdf_uncompress:
\ExplSyntaxOff
\usepackage[
bookmarks,
colorlinks,
unicode,
baseurl={https://www.latex-project.org},
]{hyperref}
\begin{document}
%\hyperbaseurl{https://www.latex-project.org}
\href{publications.html}{Publications of the \LaTeX3 Project Team}
\url{publications.html}
\href{run:test-utf8.log}{run something}
\hyperbaseurl{https://www.latex3.de/}
\href{help/books.html} {Books about \LaTeX}
\url{publications.html}
\href{run:test-utf8.log}{run something}
\end{document}
Possible fix for file:
\makeatletter
\def\@hyper@linkfile file:#1\\#2#3#4{%
%file url,link string, name, original uri
\filename@parse{#1}%
\ifx\filename@ext\relax
\edef\filename@ext{\XR@ext}%
\fi
\def\use@file{\filename@area\filename@base.\filename@ext}%
\Hy@IfStringEndsWith\filename@ext\XR@ext{%
\hyper@linkfile{#2}{\use@file}{#3}%
}{%
\ifx\@baseurl\@empty
\hyper@linkurl{#2}{%
#4\ifx\\#3\\\else\hyper@hash#3\fi
}%
\else
\hyper@linkurl{#2}{\@baseurl\use@file\ifx\\#3\\\else\hyper@hash#3\fi}%
\fi
}%
}
But probably changing \@hyper@readexternallink is better.