Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Question Footnotes on the same line revealed that it is a good idea to use \usepackage[para]{footmisc}. However, this does not seem to work with URLs:

\documentclass{article} 
\usepackage{hyperref}
\usepackage[para]{footmisc}
\begin{document} 
test\footnote{\url{http://www.example.org/long-URL/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long}}
\end{document}

undesired result

The given URL is not wrapped (but footnote 2 and 3 are on the same line). If footmisc is not loaded, the URL is wrapped perfectly. What can I do if I want to use footnotes with URLs next to each other?

More complex example (following answer http://tex.stackexchange.com/a/56706/9075):

\documentclass{article} 
\usepackage[para]{footmisc}
\usepackage{hyperref}

\def\myurl#1{\setbox0\vbox{\hsize.5\maxdimen
\url{#1}\par
\global\setbox1\lastbox}\unhbox1 }

\begin{document} 

test\footnote{\myurl{http://www.example.org/long-URL/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long}}

ODE\footnote{\myurl{http://ode.apache.org/}}). 
SOAP/http\footnote{\myurl{http://www.w3.org/TR/soap12-part2/}} 
\end{document}

The output is as follows:

unexpected result

I'd like to have footnote 2 and 3 on the same line

share|improve this question
1  
Be sure to load hyperref after footmisc. –  Mico May 20 '12 at 23:59
add comment

2 Answers 2

up vote 9 down vote accepted

To make it work with para automatically you need a modified version of \url

enter image description here

as noted in the comments, you the first version added parfillskip glue after each url which padded to the end of the line, This version removes that.

\documentclass{article} 
\usepackage[para]{footmisc}
\usepackage{hyperref}

\def\myurl#1{\setbox0\vbox{\hsize.5\maxdimen
\url{#1}\par
\setbox0\lastbox
\global\setbox1\hbox{\unhbox0\unskip\unskip\unpenalty}}\unhbox1 }

\begin{document} 
test\footnote{\myurl{http://www.example.org/long-URL/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long}}

ODE\footnote{\myurl{http://ode.apache.org/}}). 
SOAP/http\footnote{\myurl{http://www.w3.org/TR/soap12-part2/}} 
\end{document}
share|improve this answer
    
Unfortunately, it does not work on all cases (see above) –  koppor May 21 '12 at 8:26
    
code updated to remove skip after each url –  David Carlisle May 21 '12 at 9:30
    
Is it possible to reduce the space between the footnotes? For me, there seems to be much space before "2" and "3". –  koppor May 23 '12 at 16:01
    
TeX doesn't "want" to put a lot of space there, but with the limited number of places it can break a URL it has to over-stretch the space between paras (and complain in the log about underful boxes) You can get a better stretcing and no warnings by adding ` \Urlmuskip = 0mu plus 2mu` which allows a bit of white space around / and other url break-able characters, –  David Carlisle May 23 '12 at 16:34
add comment

If you remove the [para] option for footmisc, every thing works smoothly.

\documentclass{article}
\usepackage{footmisc}
\usepackage{hyperref}
\begin{document}
test\footnote{\url{http://www.example.org/long-URL/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long}}
\end{document}

enter image description here

Edit: If you want to keep the para option for footmisc, we can pass the option [obeyspaces,spaces] to url (loaded by hyperref) and give a space where the line has to be broken. Since there comes an option clash between footmisc, we pass it to the documentclass.

\documentclass[obeyspaces,spaces]{article}
\usepackage[para]{footmisc}
\usepackage{hyperref}
\begin{document}
test\footnote{\url{http://www.example.org/long-URL/long/long/long/long/long/long/long/long/long/ long/long/long/long/long/long}}
\end{document}
share|improve this answer
    
I really want to have the [para] option in place: I want to save space in a paper. –  koppor May 20 '12 at 23:34
    
@koppor: See the edit. –  Harish Kumar May 20 '12 at 23:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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