2
\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} am 27.07.2018 20:03}

generates this footnote:

URL with spaces inbetween text How do I remove the tab or the blanks/spaces between "Quelle: " and the url and after the URL ends?

// EDIT: The package "url" is in use with option [spaces, obeyspaces].

  • 3
    Welcome to TeX.SX! It probably won't help you, but this is a general line breaking problem. TeX can only produce nicely filled if the text in the can be hyphenated properly and if there is enough whitespace to shrink and stretch. The URL is an unstretchable chunk and the date can not be broken, so you are left with subpar line breaks. – moewe Jul 28 '18 at 10:14
  • Please tell us more about your document setup. In particular, do you load either the url package or the hyperref package (or both)? If so, which which options do you load these packages? – Mico Jul 28 '18 at 10:26
  • 1
    Just the url-package – HappyR Jul 28 '18 at 10:31
5

(updated the code used in the answer after the OP mentioned that the scrreprt document class is used)

I'd like to suggest that you consider two possible "fixes" to the excessive-whitespace issue:

  • Insert \raggedright at the beginning of the argument of \footnote. This will produce a short first line in the footnote, but that's still much better than staring at excessive amounts of inter-word whitespace. (By the way, as @moewe has noted in comments posted below this answer, using \raggedright in footnotes can produce some rather bad outcomes if one of the KOMA-script document classes, such as scrreprt, is used. However, in the case of your document, the otherwise-deprecated option bibtotoc counteracts this bad tendency and footnote turns out to be OK. See @moewe's comments for more information.)

  • Alternatively, do look into whether rewriting the footnote, even in a minor way, makes the over-stretching issue go away.

The following screenshot shows three footnotes. The first tries to replicate the screenshot you posted. The second employs \raggedright. The third differs from the first only in that the string 27.07.2018 is replaced with 27.\,7.\hspace{0pt}2018. As you can see from the screenshot, allowing a line break between the month and year parts of the date string can have a huge effect on where the line break occurs -- and hence on how much interword whitespace is needed in the first line of the footnote.

enter image description here

Incidentally, while there's nothing wrong with loading the url package with the options hyphens, obeyspaces, and spaces (in fact, it's almost always a very good idea to do so!), specifying these options doesn't make a difference in the present case, since the problem is not related to LaTeX not being able to find a suitable line break in the URL string. Instead, the problem is related to the fact that LaTeX won't line-break the date string 27.07.2018.

\documentclass[a4paper, 11pt,bibtotoc,abstracton]{scrreprt}
\usepackage[textwidth=14.1cm]{geometry} % trying to mimic the OP's setup
\usepackage[hyphens,spaces]{url}
\urlstyle{same} % to mimic the screenshot posted by the OP
\begin{document}

\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} 
     am 27.07.2018 20:03}

\footnote{\raggedright Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} 
     am 27.07.2018 20:03}

\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} 
     am 27.\,7.\hspace{0pt}2018 20:03}

\end{document}
  • +1: It is worth pointing out though that scrartcl's \footnotes don't fare particularly well with \raggedright when one compares them to a non-ragged footnote. From the screenshots the line breaking the OP gets is very close to the defaults of scrartcl and not that close to article defaults. Of course I'm wildly speculating for lack of an MWE. – moewe Jul 28 '18 at 11:18
  • @moewe - Thanks. I'd also very much appreciate if the OP provided more information about which document class is in use (and related pertinent information)... – Mico Jul 28 '18 at 11:27
  • 1
    Aha. The deprecated bibtotoc sets version=first. If version=last (the default) is specified, I get the undesired behaviour. The behaviour changed between version=3.21 and version=3.22. – moewe Jul 28 '18 at 13:49
  • 1
    The question is whether or not we should ask Markus Kohm if this is a bug in the newer versions that should be fixed... I'm not sure if \raggedright at the beginning of a footnote is best practice ... – moewe Jul 28 '18 at 14:11
  • 1
    I posted a supplementary answer with a work-around for the new footnote definitions. Given that there is an interface to change the justification of the text I tend to think that the fact that \raggedright does not work is an accepted result of the new implementation. I don't know if \raggedright should even be used in \footnote and don't know enough about the internals. So I won't bother MK with this, but feel free to contact him about this if you feel more strongly about this or have reason to believe it should work. – moewe Jul 28 '18 at 18:30
3

In newer versions of KOMA-Script (>=3.22) a new implementation of some footnote internals mean that \raggedright at the beginning of a \footnote moves the footnote number to the right. The output is not particularly desirable so a simple \footnote{\raggedright ....} is ruled out, especially in combination with other non-\ragged footnotes.

\documentclass[version=3.23]{scrartcl}
\usepackage[textwidth=14.1cm]{geometry} % trying to mimic the OP's setup
\usepackage[hyphens,spaces]{url}
\urlstyle{same}

\begin{document}
\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} am 27.07.2018 20:03}

\footnote{\raggedright Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} am 27.07.2018 20:03}
\end{document}

Two footnotes at the bottom of the page: The marker and text of the second footnote starts a not insignificant distance to the right compared to the first footnote.

The undesired behaviour is not visible in Mico's answer because the legacy option bibtotoc enables an older compatibility setting where the old footnote behaviour was still present.

Since version 3.23 KOMA-Script classes have a command called \raggedfootnote that can be used to set footnotes with different justification from the main text.

The settings are global, but you can restrict them to the next footnote only by enclosing them in a group. The MWE below uses \RaggedRight of ragged2e instead of \raggedright, but the same holds for \raggedright.

\documentclass[version=3.23]{scrartcl}
\usepackage[textwidth=14.1cm]{geometry} % trying to mimic the OP's setup
\usepackage{ragged2e}
\usepackage[hyphens,spaces]{url}
\urlstyle{same}

\begin{document}
\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} am 27.07.2018 20:03}

\begingroup
\let\raggedfootnote\RaggedRight 
\footnote{Quelle: \url{https://www.khronos.org/webgl/wiki_1_15/index.php/BlacklistsAndWhitelists} am 27.07.2018 20:03}
\endgroup
\end{document}

Two two-line footnotes at the bottom of the page: Footnote 1 is justified and has large spaces between the words in the first line. Footnote 2 is right aligned and does not have excessive white space between words, but of course the contents of the first line don't meet the right-hand margin, the line ends a good bit before the margin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.