2

I have a link to a URL looking like this

http://www.abc.de/~doo/bar/foobar.htm

As you can see, it contains a ~. I tried changing the link to

http://www.abc.de/\~doo/bar/foobar.htm

However, the ~ goes over the d, something like ñ. How can I display the tilde properly?

That is the file entry

@webpage{rajapakse2008,
    Author = {Rajapakse, Damith C.},
    Date-Added = {2018-01-25 14:31:33 +0000},
    Date-Modified = {2018-05-03 21:05:13 +0000},
    Lastchecked = {25.01.2018},
    Month = {04},
    Title = {Fragmentation of Mobile Applications},
    Url = {http://www.comp.nus.edu.sg/\~damithch/df/device-fragmentation.htm},
    Year = {2008},
    Bdsk-Url-1 = {http://www.comp.nus.edu.sg/~damithch/df/device-fragmentation.htm}}
moewe
  • 175,683
four-eyes
  • 335
  • 1
    This post might be useful. Although, for URLs you shouldn't need escaping, as BibLaTeX buts them in a verbatim context automatically. – Phelype Oleinik May 03 '18 at 21:15
  • Can you show us the resulting .bib entry? If you indeed use biblatex, you should use the url field, that field is a special verbatim field where special characters need not (and should not!) be escaped. If you use BibTeX and must resort to note or howpublished you should look into wrapping your URLs in \url{...}. – moewe May 03 '18 at 21:15
  • @moewe added the entry to the question. I have to escape all special characters though... – four-eyes May 03 '18 at 21:18
  • 1
    OK, then we need to know what bibliography package (cite, natbib, biblatex, ...) and which style you use. The handling of URLs differs between biblatex (where things are largely handled uniformly) and BibTeX styles (with vastly varying degrees of support for URLs). Please consider adding a full MWE/MWEB that shows this. – moewe May 03 '18 at 21:21
  • @moewe I use natbib with a modified agsm, namely this one: https://gist.github.com/moewew/6c65c256c9420d64f3b264c0a78774c0 its yours :) – four-eyes May 03 '18 at 21:26
  • No wonder it doesn't work then .... Try \renewcommand{\harvardurl}[1]{\textbf{URL:} \url{#1}} (https://tex.stackexchange.com/q/9445/35864) – moewe May 03 '18 at 21:29
  • @moewe I have that already in it \renewcommand{\harvardurl}[1]{[Online] URL: \textit{#1}} – four-eyes May 03 '18 at 21:32
  • 1
    That's why we ask for MWEs on this site, that would have been an important bit of information. Try \renewcommand{\harvardurl}[1]{[Online] URL: \url{#1}} then (if that produces an error you may have to load the hyperref or url package - depending on whether you like links in general or not). – moewe May 03 '18 at 21:36
  • @moewe Hm, I dont wanna use a \url in there. I use \textasciitilde as suggested by Phelype Oleinik - that does the trick somewhat – four-eyes May 03 '18 at 21:44
  • 1
    Why do you not want to use \url? That command really is the simplest way to tell LaTeX that you are typesetting a URL. URLs require special treatment, so LaTeX normally botches them badly unless specifically told to handle it otherwise. If you don't like the fact that url/hyperref print URLs in typewriter font by default you can use \urlstyle to change that. – moewe May 03 '18 at 21:49
  • To people of the future, a crude way to deal with this is to use $\sim$ everywhere you would have a tilde. E.g."http://www.comp.nus.edu.sg/$\sim$damithch/df/device-fragmentation.htm" – Craig Oct 07 '22 at 20:49

0 Answers0