[pdftex] Tilde character in url.

Ross Moore ross at ics.mq.edu.au
Mon Apr 12 00:55:23 CEST 2010


On 11/04/2010, at 11:06 PM, risse wrote:

> Dear Ross,

>> Beware to make all your uses of \urldef come *before*
>> loading  {hyperref}  because then \url  gets redefined,
>> and the   \urldef\<cs-name>\url  sequence will no longer
>> work as designed within  url.sty .
>> However, the attached .tex file shows how even this limitation
>> can be easily overcome.
>>
> I pdflatex'ed Your test file url-test.TeX using MikTeX 2.7,
> everything works fine (see attachment),
> but for some reason the second URL is not clickable.

Oops, you are right, it is not clickable.

> Would You be so kind to enlighten me ;-)

Sorry, I skipped one step in this solution.
Try this in the preamble --- note the 1 extra line:

>>> \usepackage{url}
>>>   \urldef\konspektURL\url{http://staff.ttu.ee/~alahe/konspekt/myCD/}
>>> \let\urlurl\url
>>> \AtBeginDocument{\renewcommand{\urlurl}{\protect\url}}%  <<<---   
>>> add this
>>> \usepackage{hyperref}
>>>   \urldef\konspektURLpdf\urlurl{http://staff.ttu.ee/~alahe/ 
>>> konspekt/myCD/opik_eme_html.pdf}



This allows \urldef  to be used anywhere *within the preamble*,
(after the  \let\urlurl\url  line)  provided that you use

     \urldef\<macroname>\urlurl{... the URL or URI ...}

after  hyperref.sty  has been loaded.

You cannot use  \urldef  this way within the body source
(i.e., after  \begin{document}  ).


But that kind of restriction actually has some advantages.
If a target URL changes, and you have used its \urldef'd macro
several times, then you only change it in one place.

This place is easily locatable in the document preamble,
so there is no need to search for the instances where it is used.
Even nicer is to declare all the URLs in a file that is \input
as part of your preamble; which file can also be used with other
documents.



> best Thomas Risse
>
> <url-test.pdf>


Thanks for pointing out this extra issue.

Cheers,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the pdftex mailing list