[pdftex] Tilde character in url.

Andres Lahe alahe at staff.ttu.ee
Sat Apr 10 06:48:52 CEST 2010


Ross Moore wrote:
> Hi Andres, and John,
>
> On 10/04/2010, at 5:29 AM, Andres Lahe wrote:
>
>> John Culleton wrote:
>>>
>>> On Friday 09 April 2010 14:08:02 Reinhard Kotucha wrote:
>>>>
>>>> On 9 April 2010 John Culleton wrote: > In plain pdftex I am typing 
>>>> the following url: > \url{http://www.tux.org/~milgram/bookland} > 
>>>> {http://www.tux.org/~milgram/bookland} > > The problem is the tilde 
>>>> character. TeX persists in treating it > either as an unbreakable 
>>>> space or as an accent over the following > character. The tag 
>>>> \tilde only works in math mode and again it > wants to be on top of 
>>>> the next character. The tilde is an active character. 
>>>> \bgroup\catcode`\~=12 \url{http://www.tux.org/~milgram/bookland} 
>>>> {http://www.tux.org/~milgram/bookland} \egroup You can also try 
>>>> \~{}. The empty group prevents TeX from putting it over the 
>>>> following character. Regards, Reinhard
>>> First thanks to those who responded. The problem is not just 
>>> printing the character but also passing it on to the local web 
>>> browser. Your first solution, with the \catcode change enclosed in 
>>> \bgroup \egroup etc. is the one that works. The second suggestion 
>>> with \~{} prints OK but does not reproduce properly in the url. I 
>>> did not try Wouter's suggestions, since yours came first, and works 
>>> :<) Now I have to republish the e-book wherever it exists :<(
>> For pdflatex I use  \string~   
>> \hyperbaseurl{http://staff.ttu.ee/\string~alahe/konspekt/myCD/}
>> and it works: 
>> http://staff.ttu.ee/%7Ealahe/konspekt/myCD/opik_eme_html.pdf
>
> There is a good solution, which has not been mentioned yet.
> It is due to Donald Arseneau, back in 1996,
> using the  \urldef  macro defined in his package  url.sty .
>
> In your preamble load packages and make declarations as follows:
>
> \usepackage{url}
> \urldef\konspektURLpdf\url{http://staff.ttu.ee/~alahe/konspekt/myCD/opik_eme_html.pdf} 
>
>
>  ... specify further URLs here ....
>
> \usepackage[... options...]{hyperref}
>
> Now in the body of your document you can simply use:
>
>  \konspektURLpdf
>
> to get an active URL, properly typeset.
>
>
> There is no messing around with catcodes or other fake character
> constructions in the body of your (La)TeX source, and even long URLs
> break in appropriate places.
>
> 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.
>
>
>
> Any suggestion to use the %7E syntax within (La)TeX documents
> is fraught with danger --- of course using  \%7E .
> Imagine what would happen if the user forgot to escape the % !!
>
> The processing would most certainly fail and the error messages
> would be totally incomprehensible to most users --- even if
> they bothered to look at the .log file or console.
> Traffic to mailing lists would sky-rocket, following adoption
> of such a policy.
>
>
>
>> Andres
>>
>
>
> Hope this helps,
>
>     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
> ------------------------------------------------------------------------
>
>
>
Thank you!
I have makeing ebook and put it on the memory stick and intenet to.
%\hyperbaseurl{file:///Z:/}  % worked
%\hyperbaseurl{file:///media/E_OPE/}  % worked for linux
\hyperbaseurl{http://staff.ttu.ee/\string~alahe/konspekt/myCD/}  % worked
It works. In 
internet:http://staff.ttu.ee/~alahe/konspekt/myCD/opik_eme_html.pdf
  In memory stick I have cataloge for skreencast: /ekraanivideo,  
/slaids, ...
For student is instruction how put all in memory stick:
  http://staff.ttu.ee/~alahe/konspekt/myCD/ahtml/MaluPulk.html
In bookmarks for umlaut \~{o} I have  1ex126-.45ex1265o then I
replace it with \365  and all is OK!



More information about the pdftex mailing list