I would like to write a macro similar to the \href command from the hyperref package, but which takes a single argument. The URL is generated by making the argument lowercase.
Here is a minimal example:
\documentclass{article}
\usepackage{hyperref}
\newcommand\mylink[1]{\href{www.\lowercase{#1}.com}{#1}}
\begin{document}
\mylink{MyURL}
\end{document}
However, the \lowercase command is not expanded, and the link points to www.\lowercase{MyURL}.com. Is there a way to solve this problem?
\show\mylinkafter\begin{document}and tex will stop and show you the definition, if it isn't your definition something else is defining it. – David Carlisle Jan 28 '13 at 11:31\href? I might want to do something like:\href{mailto:\lowercase{#1}.\uppercase{#2}}{#1.#2}– Frederick Nord Feb 11 '13 at 17:07\href: the problem is that\lowercaseis not an expandable command, I'll add code to the answer for this – David Carlisle Feb 11 '13 at 17:36\hrefrequires initialhttp://orhttps://to work while this answer seems to not put that. Any idea? – user202729 May 14 '23 at 10:17\lowercasewould mess up utf8 in pdftex (probably I should add an expl3 case change answer) – David Carlisle May 14 '23 at 10:37