%% This should be included AFTER any and all usepackage stanzas. This is because hyperref must %% be the last imported package! \usepackage[activate={true,nocompatibility},% final,% tracking=true,% kerning=true,% spacing=true,% factor=1100,% stretch=10,% shrink=10]{microtype} \microtypecontext{spacing=nonfrench} \usepackage{xspace} \xspaceaddexceptions{]\}} \usepackage{graphicx} \usepackage{amssymb} \usepackage[T1]{fontenc} \usepackage{xstring} \usepackage{textcomp} %\usepackage{cite} \newcommand{\etal}{\emph{et al.}\xspace} \newcommand{\cf}{\emph{c.f.}\xspace} \newcommand{\vs}{\emph{vs.}\xspace} \hyphenation{Wi-de-spread Fra-me-works Fra-me-work De-cla-ra-tion Wide-spread La-ngu-age Syn-tax A-bou-nd} %%%%%%% END IMPORTS % should be the last import: \usepackage{hyperref} \hypersetup{% colorlinks,% citecolor=Blue,% linkcolor=black,% urlcolor=Blue} %inspiration: http://tex.stackexchange.com/questions/153215/how-to-do-multiple-string-replacements \newcommand{\subsurl}[1]{{% \noexpandarg % suppress expansions made by xstring \StrSubstitute{#1}{http://}{http:{//}}[\x]% first step; avoid breaking inside http:// :| \expandafter\StrSubstitute\expandafter{\x}{https://}{https:{//}}[\x]% \expandafter\StrSubstitute\expandafter{\x}{-}{-\allowbreak }[\x]% \expandafter\StrSubstitute\expandafter{\x}{/}{\allowbreak/}[\x]% %\expandafter\StrSubstitute\expandafter{\x}{\`}{\%60}[\x]% \x}} % omigod ugly hack since otherwise http:// -> http:/\allowbreak /... \renewcommand{\url}[1]{\href{#1}{\texttt{\subsurl{#1}}}} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: