24

A picture is worth a thousand macros:

alt text

I don't blame LaTeX for having difficulty in formatting this entry.

What can I do, however, to alleviate the effects and avoid the Word-like indentation?

A related question suggested by the site is How to get long \texttt sections to break which indeed produces a better aligned entry: alt text

While I like the sane alignment, I'm not not very happy with the switch to a monospaced font (while it works in the regular text, in bibliographical entries it attracts too much attention and takes too much space).

Any other suggestions?

The entry for the above test bibitem is:

\begin{thebibliography}

\bibitem{anything-here}
"Lorem Ipsum Society,
\emph{dolor sit amet, consectetur}, May 2010
retrieved on Oct 16, 2010 from http://www.lorem-ipsum.com/whatever-here/about\%20something/here\%20takes/space\%20in\%20a\%20long/url\%20foobar.aspx 

\end{thebibliography}

3 Answers3

16

Preamble:

\usepackage{url} % hyperref works too
\urlstyle{same}  % (sf also works, for something more subtle than tt)

Then insert urls as:

\url{http://www.example.com/~lev/my%20long%20url}
Lev Bishop
  • 45,462
3

I think that \raggedright might be your friend here. You don't get justified entries, of course, but that can often look much better than having many underfull lines.

Before trying that, you can try to convince the various url handling packages to break lines. I have

\usepackage[hyphens]{url}
\ifpdf
\usepackage[breaklinks=true,pdfborder={0 0 0},bookmarksopen]{hyperref}
\else
\usepackage[pdfborder={0 0 0},bookmarksopen]{hyperref}
\usepackage[hyphenbreaks]{breakurl}
\fi

in one paper I wrote. I can't remember the rationale for using url and hyperref, but I must have had a reason at one point.

The microtype package might be able to help you get better breaks too.

TH.
  • 62,639
0

I had a similar problem which I solved using the following:

\usepackage{url}
\urlstyle{same}
\def\UrlBreaks{\do\/\do-}

I had in the URL too many - and /, but I guess you could make it work to break at % as well.

zzkr
  • 133