- #1
Eclair_de_XII
- 1,083
- 91
- TL;DR Summary
- I am trying to create a macro that will pass a given string as an argument, to insert into the hyperlink that the macro will output. The problem is, that sometimes the given string will sometimes not be in lowercase, and the hyperlink will link to something else, because the site is case-sensitive.
My attempt resulted in the error found in the body of this message.
Running this
gives
Code:
\documentclass{article}
\usepackage{hyperref}
\usepackage{textcase}
\newcommand{\wiki}[2]{\href{https://en.wikipedia.org/wiki/#1_\MakeLowercase{#2}}{Curriculum vitae}}
\begin{document}
\wiki{Curriculum}{Vitae} % Wikipedia redirects this URL to the one below
\href{\https://en.wikipedia.org/wiki/Curriculum_vitae} % This one takes the user directly to the intended page
\end{document}
gives
Code:
! Use of \Hy@href doesn't match its definition.
\MakeLowercase #1->{\def \reserved@a ##
1##2{\let ##2##1\reserved@a }\expand...