[OS X TeX] Funny bug in hyperref
Ross Moore
ross.moore at mq.edu.au
Fri Jul 6 22:36:58 CEST 2012
Hi Alain, and Victor,
Since your example loads the url package,
it is often a good idea to make use of \urldef , which it defines.
>
>> \documentclass[11pt]{book}
>> \usepackage[T1]{fontenc}
>> \usepackage{pdfsync}
>> \usepackage{url}
\urldef\MetricUSurl\url{http://en.wikipedia.org/wiki/Metrication_in_the_United_States}
>> \usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}]
>>
>> \begin{document}
>> \chapter{Chapter}
>> \section{Section The First}
>> Some text
>> \vspace{100mm}
>> Some text
>>
>>
>>
>> Some text before Some text before Some text before Some text before Some
>> text before Some text before Some text before
\MetricUSurl.)
%\url{http://en.wikipedia.org/wiki/Metrication_in_the_United_States}.)
>>
>>
>> \section{Section The Second}
>>
>> Some text
>>
>> \end{document}
The use of \urldef *must* come before hyperref is loaded, since hyperref changes the definition of \url .
After hyperref has been loaded, the syntax of \urldef\....\url{...} will fail, because of that redefinition. But it is handy to have all of your URLs defined in the preamble, so that the body of your document is not cluttered with long URL constructions, but just neat meaningful macro names. URLs defined this way also work in footnotes, and within expansions of other macros, since all the required catcode changes for special characters have already taken place.
> Methinks that the problem is in underscore.
>
> Use
>
> \href{http://en.wikipedia.org/wiki/Metrication_in_the_United_States}{http://en.wikipedia.org/wiki/Metrication\_in\_the\_United\_States}.
\urldef avoids the need for this kind of duplication.
>
> instead
>
>
> Victor
Cheers,
Ross
More information about the macostex-archives
mailing list