Closed Reissner closed 2 years ago
\url
is not defined by hyperref but by the url package. And by design it must be able to handle for example windows pathes with backslashes like C:\users\whatever
. So it can't expand arbitrary commands. But you can define your own variant, e.g.:
\documentclass{article}
\usepackage{url}
\begin{document}
\newcommand\myurl{\expandafter\url\expandafter}
\newcommand\repo{myrepo}
\myurl{\repo}
\end{document}
Be aware that your repo url then can't contain special chars like a percent or a hash as url no longer can adapt the catcodes.
I need \url{...} with configurable content, as \url{\repo}, \repo resolved to be some repository. This does not work. I think within \url commands are not resolved. This should change in my opinion.