1

Using pdflatex and bibtex, this code gives me a spurious percent symbol.

\documentclass[twocolumn]{article}
\usepackage{url}

\begin{document}
hello \cite{hello}.

\bibliographystyle{plain}
\bibliography{android}
\end{document}

bib entry:

@misc{hello,
  author={{John Smith}},
  title={My Title},
  note={\url{http://tex.stackexchange.com/questions/4213/how-to-deal-with-bibliography-items-containing-long-urls}},
}

Rendered doc:

enter image description here

Note the '%' at the end of third line. How to fix it?

4

bibtex limits the line length and inserts line breaks with preceding percent character. Usually the percent is the comment char, but this is not the case in \url, whose argument is read in verbatim manner.

This issue was fixed in:

% ver 1.6 20-Jun-2002`
% [...] ignore trailing %, [...]

Probably you are using a version of package url that is more than ten years old. The current version is ver 3.3 12-Apr-2006.

An update of package url should fix the problem. Also it might be possible that different versions are installed and the outdated version is found first.

  • thanks, I am using the default latex packages in Fedora 17. I seem to have quite a few url.sty files on the system but /usr/share/texmf/tex/latex/html/url.sty and /usr/share/texmf/tex/latex/ltxmisc/url.sty seem to be the most likely ones to be used. One is version 1.4 (html/url.sty) and the other is version 3.2 (ltxmisc/url.sty). How to figure out which one is being used and change to the right one? – r.v Jun 11 '13 at 22:03
  • Ok, got it. just used \usepackage{ltxmisc/url}. All % problems fixed now. Thanks! – r.v Jun 11 '13 at 22:08
  • @r.v: This is a bug in your Fedora's TeX installation, because TDS requires uniqueness for the files below TDS:tex/latex/. – Heiko Oberdiek Jun 12 '13 at 3:07
  • @r.v: \usepackage{ltxmisc/url} does not solve all problems, because other packages (e.g. hyperref) might load package url. Also you get a LaTeX Warning: You have requested package "url/url", but the package provides "url" in the .log file. I would install the uptodate url.sty in $TEXMFLOCAL/tex/latex/url/url.sty or $TEXMFHOME/tex/latex/url/url.sty. – Heiko Oberdiek Jun 12 '13 at 3:12
  • I checked and found that the html/url.sty version was provided by the latex2html package while the other was provided by the standard texlive package. Perhaps the two should have been consistent. Thanks for showing how to override the system settings with the local ones. – r.v Jun 13 '13 at 2:10

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.