0

I'm using Overleaf and I recently noticed that the URL of a footnote gets stretched. This leads to the problem that when I copy the URL from the pdf that LaTeX generates and paste it in a browser, it won't lead anywhere because what I paste is as follows:

https : / / youtu . be / UDHROiqYI5o

So, LaTeX seems to add spaces to URLs around semicolons, slashes, and dots. I suspect that LaTeX tries to justify sentences in a way that avoids creating large white spaces between any two words, but it comes at the cost of broken URL's and I want to see if there's a better way to do justification. How do I prevent LaTeX from adding spaces to URL's?

  • Please have a look at the xurl package. – Dr. Manuel Kuehner Apr 10 '22 at 15:46
  • 4
    Does this answer your question? How to stop LaTeX stretching my footnote or https://tex.stackexchange.com/questions/23394? – Dr. Manuel Kuehner Apr 10 '22 at 16:06
  • I think the issue is not loading hyperref. @MS-SPO pointed that out in the answer below. – Douglas Myers-Turnbull Apr 10 '22 at 18:13
  • Loading the xurl package doesn't seem to work for this scenario. And although hyperref doesn't remove the space, it does make it clickable even with the space, and this works when in the PDF, so I guess it's a solution to the problem. – AWriterWhoAsks Apr 10 '22 at 18:35
  • I was going to post an answer to your subsequent question. Unfortunately, you deleted that posting minutres before I could post the answer. – Mico Apr 10 '22 at 18:42
  • That's unfortunate. I was already frustrated by the fact that this question got closed and flagged as duplicate far too quickly, and I became more frustrated when people started downvoting the subsequent question and even this one. I tried deleting this one too but it already has a response. Did you have a solution? – AWriterWhoAsks Apr 10 '22 at 19:25
  • 1
    Without code, it's impossible to experiment to see why what you describe is happening. What I would try is to use \raggedright for affected footnotes; clearly, unworkable "links" are worse than useless. – barbara beeton Apr 10 '22 at 19:52
  • For the record, I did not downvote but I proposed a duplicate. As the previous comment already makes clear, the information given is a bit thin for a more specific discussion. – Dr. Manuel Kuehner Apr 10 '22 at 22:31

1 Answers1

3

Not sure, what you are doing, as you didn't post any code. So here's an example, which doesn't reproduce your description, unfortunately:

\documentclass[10pt]{article}

\usepackage{hyperref}

\begin{document} Lorem ipsum dolor sit amet consectetuer pretium et tincidunt habitant eget. Sed enim nunc elit tempus et nibh egestas arcu.\footnote{http://youtube.com/wasHere}

Id massa augue quis Maecenas rhoncus nulla amet lacinia justo at. Elit Maecenas lacinia tortor lacus Suspendisse Vestibulum vitae urna dolor. \footnote{\url{http://ms-spo.de}}

\end{document}

As you can see, no extra blanks; if in doubt, use hyperref, to just click on the link:

enter image description here

MS-SPO
  • 11,519
  • Strictly speaking, I wanted to get rid of the spaces that were inserted into the URL, but hyperref does somewhat solve the issue, so I flagged yours as the answer. – AWriterWhoAsks Apr 10 '22 at 19:27