Is it possible to define URL prefixes and correctly provide hyperrefs for them?
For example:
\defineprefix{dbo}{http://dbpedia.org/ontology/}
\prefixurl{dbo:City}
Should have the same effect as:
\href{http://dbpedia.org/ontology/City}{dbo:City}
Edit: This is the MWE of the accepted code where it causes an error:
\documentclass{article}
\usepackage{hyperref}
\makeatletter
\newcommand\defineprefix[2]{%
\def\urlprefixabbrv@#1{#2}}
\newcommand\prefixurl[2]{%
\href{\urlprefixabbrv@#1/#2}{#1:#2}}
\makeatother
\begin{document}
\defineprefix{owl}{http://www.w3.org/2002/07/owl\#}
\defineprefix{xsd}{http://www.w3.org/2001/XMLSchema\#}
\prefixurl{owl}{Class}
\prefixurl{xsd}{string}
\end{document}
\prefixurl
flexible? It would be somewhat easier to code if you allow the syntax\prefixurl{dbo}{City}
. – Willie Wong Oct 22 '15 at 14:47