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.

Could someone help to correct the warning I get related to an underfull box with the following code? I have tried \hfill, hspace*{\hfill} etc with no luck.

\documentclass[twocolumn,draft]{svjour3}
\usepackage{lmodern}
\usepackage{url} 

\usepackage[breaklinks]{hyperref} %make hyperlinks references
    \hypersetup{colorlinks=true,linkcolor=blue,          % color of internal links
        citecolor=blue,linktocpage=true}
\usepackage{breakurl}


\begin{document}

\title{Something}

Microsoft continued to gain market \footnote{\url{www.some-asd-sdsasdasd-asdas-dasdas-dasdas-asd.com}}

\end{document}

So the answer to this is to use: the following: \usepackage{ragged2e}
\footnote{\RaggedRight\url{www.some-asd-sdsasdasd-asdas-dasdas-dasdas-asd.com}}

Credits to How can I make my text never go over the right margin by always hyphenating or breaking on word-boundaries?

share|improve this question
    
Man I gave up trying to fix those types of error/s a long time ago... –  Nicholas Hamilton Dec 29 '12 at 20:32
1  
Welcome to TeX.sx! Things like that require luck; it's nearly impossible to break correctly paragraphs with long URLs. Can you give a more realistic example? –  egreg Dec 29 '12 at 21:10
    
Nope :). IMO this example expresses all I want. I have a long url in a footnote which breaks into multiple rows (in a two column class) and does not fill the box. –  Alex Dec 30 '12 at 10:12
1  
while it's possible to break a url, i think it may not be possible to get rid of the underfull box message. i worked on a project a long time ago that needed to break long words (not just urls) automatically. we got the breaks we needed (with proper hyphenation), but just learned to live with the underfull box messages. there were few enough that they could easily be checked. –  barbara beeton Dec 30 '12 at 13:57
add comment

3 Answers

I took the following code snippet from another question:

\newcommand{\url}[1]{%
\begingroup
\ttfamily
 \begingroup\lccode`~=`/\lowercase{\endgroup\def~}{/\discretionary{}{}{}}%
 \begingroup\lccode`~=`.\lowercase{\endgroup\def~}{.\discretionary{}{}{}}%
 \catcode`/=\active\catcode`.=\active
 \scantokens{#1\noexpand}%
 \endgroup
}
share|improve this answer
    
I commented \usepackage{url} and it doesn't do the job. –  Alex Dec 30 '12 at 10:27
add comment

Inserting an \hfill before the \url, i.e. \footnote{\hfill\url{...}}, removes the warning. The only drawback of this is that it pushes the first part of the URL to the right, so that you have some extra space between the footnote number and the URL.

Another idea ist to use \footnote{\rlap{\url{...}}}. This printes the URL but ignores its width completely. The URL will stick out to the second column then, though, if it is too long.

share|improve this answer
    
Yeap. So IMO none of these are really useful! –  Alex Dec 30 '12 at 10:10
add comment

use

\footnote{\sloppy\url{www.some-asd-sdsasdasd-asdas-dasdas-dasdas-asd.com}}
share|improve this answer
    
I am sorry this does not work. –  Alex Dec 30 '12 at 10:08
    
it works for me ... –  Herbert Dec 30 '12 at 10:09
    
Do you use \usepackage{lmodern}? because if I comment this,then yes it works...but then I have other warnings like:LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <4.25> not available –  Alex Dec 30 '12 at 10:23
    
I run pdflatex without loading package breakurl which makes no sense –  Herbert Dec 30 '12 at 10:33
    
Sorry it doesn't seem to work for me. The only thing it works is to add the following code: \usepackage{etoolbox} \apptocmd{\sloppy} {\hbadness 10000\relax}{}{} taken from [1] with \sloppy. But should I do this in a journal. I do not think that this is acceptable.... [1]: tex.stackexchange.com/questions/10924/… –  Alex Dec 30 '12 at 11:00
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.