TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:



However, the \lowercase command is not expanded, and the link points to www.\lowercase{MyURL}.com. Is there a way to solve this problem?

share|improve this question
up vote 10 down vote accepted

will work.

As requested in comments a more complicated example:





share|improve this answer
Thanks, that's great. Do you know any reason why this stops working if I put in my class file rather than the preamble? Or do I need to check for conflicting settings? – Prince Goulash Jan 28 '13 at 11:07
should make no difference unless something else redefines it add \show\mylink after \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
Apologies - it was a typo that was confusing me. Thanks again for the solution. – Prince Goulash Jan 28 '13 at 12:15
Surprising that it works. But out of curiosity: How to expand stuff in \href? I might want to do something like: \href{mailto:\lowercase{#1}.\uppercase{#2}}{#1.#2} – Frederick Nord Feb 11 '13 at 17:07
Things expand automatically in \href: the problem is that \lowercase is not an expandable command, I'll add code to the answer for this – David Carlisle Feb 11 '13 at 17:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.