4

BibTeX (TeX Live 2013 on ubuntu) doesn't escape the & specifically in urls. The % escapes but not &.

For example I have the following reference:

@article{benson1975, title = {The Interorganizational Network as a Political Economy}, volume = {20}, issn = {00018392}, url = {http://www.jstor.org/discover/10.2307/2391696?uid=3737664&uid=2134&uid=2129&uid=2&uid=70&uid=4&sid=21102581457607}, doi = {10.2307/2391696}, number = {2}, urldate = {2013-08-25}, journal = {Administrative Science Quarterly}, author = {Benson, J. Kenneth}, month = jun, year = {1975}, pages = {229} } 

and when I cite it the bbl files keeps the & intact like this:

\htmladdnormallink{$<$http:\-/\-/www\-.jstor\-.org\-/discover\-/10\-.2307\-/2391696?uid=3737664&uid=2134&uid=2129&uid=2&uid=70&uid=4&sid=21102581457607$>$}{http://www.jstor.org/discover/10.2307/2391696?uid=3737664&uid=2134&uid=2129&uid=2&uid=70&uid=4&sid=21102581457607}.} 

When I manual replace the & inside the \htmladdnormallink with \& LaTeX compiles perfectly so I'm sure that is there is a way to escape the & it would work like a charm.

Note that escaping the & on BibTeX (\&) doesn't work (works outside of urls, but not in urls). The bbl result is {\textbackslash} & instead of \&:

\htmladdnormallink{$<$http:\-/\-/www\-.jstor\-.org\-/discover\-/10\-.2307\-/2391696?uid=3737664{\textbackslash}&uid=2134{\textbackslash}&uid=2129{\textbackslash}&uid=2{\textbackslash}&uid=70{\textbackslash}&uid=4{\textbackslash}&sid=21102581457607$>$}{http://www.jstor.org/discover/10.2307/2391696?uid=3737664\&uid=2134\&uid=2129\&uid=2\&uid=70\&uid=4\&sid=21102581457607}.} 

If it makes a difference, I'm using:

\documentclass[ article, 11pt, oneside, a4paper, english, brazil ]{abntex2} \usepackage{cmap} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{indentfirst} \usepackage{nomencl} \usepackage{color} \usepackage{graphicx} \usepackage[brazilian,hyperpageref]{backref} \usepackage[alf]{abntex2cite} \hypersetup{ pdftitle={\@title}, pdfauthor={\@author}, pdfcreator={\@author}, colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=magenta, urlcolor=blue, bookmarksdepth=4 } 
1
  • I don't know abntex2 class, but maybe the problem is somehow related to it? Try to use a more standard document class for the MWE - maybe this will solve the issue. Commented Aug 26, 2013 at 7:48

1 Answer 1

3

So after some fiddling around I found an option to in abntex2cite to change the url package from hyperref to url.

\usepackage[alf, abnt-url-package=url]{abntex2cite} 

This fixes the problem with &, but creates the same problem with %. Fortunately it is possible to escape using \%. The same may happen with other special characters.

Anyways, when I checked the .bbl I noticed the & is not escaped there, even tough it compiles:

\url{http://www.jstor.org/discover/10.2307/2391696?uid=3737664&uid=2134&uid=2129&uid=2&uid=70&uid=4&sid=21102581457607}.} 

Now I don't know if the bug is actually from hyperref, which should be able to escape & as the url package is or if it a abntex2 bug. Whichever that is, I inspected abntex2-alf.bst in the abntex2 package and was able to fix the problem by inserting the line below in the middle of filter.url.tex function:

duplicate$ "&" = {pop$ "\&" } 'skip$ if$ 

I will post this bug and fix on abntex2 bugtracker.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.