25

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}
2
  • I'm not sure what you mean by "Word-like indentation" here. In what respect is the indentation better in entry [18]? Commented Oct 17, 2010 at 7:09
  • 1
    @Hendrik: I suspect he didn't mean to say indentation, but is really talking about the extremely underfull lines. Commented Oct 17, 2010 at 7:20

3 Answers 3

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}
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.

2
  • 1
    I prefer to \usepackage{ragged2e} and \RaggedRight.
    – Lev Bishop
    Commented Oct 17, 2010 at 5:00
  • @Lev Bishop: Oh, I'm not familiar with ragged2e. I'll have to check it out.
    – TH.
    Commented Oct 17, 2010 at 6:28
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .