24

I am stuck with a problem of a url to some website I try to put a link to.

The URL is: http://pl.wikipedia.org/wiki/Prawo_Lewisa-Mogridge’a and Latex have an issue with the ’ symbol. I put it the very easy way:

\url{http://pl.wikipedia.org/wiki/Prawo_Lewisa-Mogridge’a}

but the result is quite different:

http://pl.wikipedia.org/wiki/Prawo_Lewisa-Mogridge%5CT1%5Ctextquoteright_a

I obviously use UTF8 but the URL is Polish. Any idea what could be done? Thanks!

2 Answers 2

19

Go to wikipedia and copy its URL as such; then add \ before each %:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\url{http://www.wikiwand.com/pl/Prawo_Lewisa-Mogridge\%E2\%80\%99a}
\end{document}

EDIT 1

Instead of \url, you can use \href, in case you want the hyperlink:

\documentclass{report}
\usepackage{hyperref}
\begin{document}
    \href{http://www.wikiwand.com/pl/Prawo_Lewisa-Mogridge\%E2\%80\%99a}
    {http://wikiwand.com/pl/Prawo\_Lewisa-Mogridge\textquoteright{}a}
\end{document}

URL with textquoteright

EDIT 2

On the other hand, according to Wikipedia, this is the right way to cite:

//pl.wikipedia.org/w/index.php?title=Prawo_Lewisa-Mogridge%E2%80%99a&oldid=39769503

Check the link

4
  • 3
    No need of adding \ when you use \url from url package (which is loaded by hyperref).
    – user11232
    Commented Jan 23, 2015 at 3:11
  • Oh well... the link is working, but it is displayed like this: pl.wikipedia.org/wiki/Prawo_Lewisa-Mogridge%E2%80%99a
    – Atais
    Commented Jan 23, 2015 at 3:11
  • @Atais. This is the right way to type it, because not every font may have the character
    – Ludenticus
    Commented Jan 23, 2015 at 3:17
  • 3
    @HarishKumar. According to the url manual (p.1), «the \url argument cannot contain any “%”, “#”, or “^^”, or end with “\”.»
    – Ludenticus
    Commented Jan 23, 2015 at 3:29
0

In case of one # inside \url in bib, I had to replicate it four times like this:

@Misc{hausdorff,
  author       = {plastimatch},
  howpublished = {\url{http://plastimatch.org/doxygen/classHausdorff__distance.html####details}},

I was in Overleaf with:

\usepackage[sorting=none]{biblatex}
\usepackage{url}
3
  • 3
    With biblatex (and all BIbTeX styles that support it) it is preferable to use the dedicated url field and not the general-purpose howpublished. You can (and should) input URLs in the url field without any escaping: url = {http://plastimatch.org/doxygen/classHausdorff__distance.html#details}, The URL will automatically be formatted with the \url macro: It need not and should not be used in the url field.
    – moewe
    Commented Jan 25, 2021 at 7:47
  • @moewe: Why it's preferable to use url over general-purpose? In case I need to use general-purpose, how can we fix this? Thanks!
    – Catbuilts
    Commented Mar 30, 2021 at 14:05
  • 1
    @Catbuilts Using the url field gives your bibliography style more control over the formatting of the URL and avoids unnecessary hard-coding of markup in the .bib file. There are some older .bst styles that don't support a url field; in that case sticking with howpublished might be easiest. But in the use cases stipulated in the answer (\usepackage{biblatex}) almost all styles support the url field, so there is no need to go for howpublished.
    – moewe
    Commented Mar 30, 2021 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .