I have the following code:
\usepackage{hyperref}
\newcommand{\version}{0.1.2}
\href{https://example.com}{version \version{}}
It produces a URL like:
If I try this instead:
\href{https://example.com/\version{}}{version}
I don't get a functional URL.
Is it possible to do something like this to construct a URL with variables in it?
https://example.com/0.1.2{}which is an invalid url. If I remove the{}at the end of your\version{}, then I indeed get a functional link pointing tohttps://example.com/0.1.2. That may solve your problem. (I found this out by putting\tracingallat the top of the file and grepping for the url. I'm leaving this as a comment rather than an answer, because I don't know enough abouthrefor about macro expansion to explain what's going on.) – ShreevatsaR Sep 25 '16 at 06:20