TeX - LaTeX Asked on August 17, 2021
I want to define something like
newcommand{myhref}[2]{href{#1}{do something with #1}}
and then paste URLs from the web into myhref{...}{hello}
.
The special characters in URLs mean that this works only if I fix up every URL (usually by preceding special characters with a ). It would be much more pleasant if I could tell myhref
to inherit the rules of treating urls in argument #1 just-as-if-pass-verbatim from/to href
.
the question is closely related to Problem with use of '#' in custom href command . However, I need a more general solution. Unfortunately, URLs cannot just contain # , but _ and & and probably a few more special characters. Is there a more general solution?
documentclass{article}
usepackage{hyperref}
makeatletter
DeclareRobustCommand*{myurl}{hyper@normalisemyurl@}
defmyurl@#1{hyper@linkurl{See also: textbf{#1}}{#1}}
makeatother
begin{document}
myurl{https://github.com/latex3/hyperref/issues?q=is%3Aissue+is%3Aopen+tuburl}
end{document}
Answered by Ulrike Fischer on August 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP