3

When I include url in the .bib file latex throws the error:
Tex capacity exceeded, sorry[save size=5000]

Do you have any idea why?
Below I paste the package I use and one reference

\documentclass[english]{article}
\usepackage[utf8]{inputenc} %write accent without the \ [' ` ^] 
\usepackage{lmodern,textcomp} % + the above package use euro directly
\usepackage{babel}
\usepackage{harvard}
\bibliographystyle{agsm}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage[margin=1.5in]{geometry}
%\usepackage{times}

\begin{document}

as in \cite{AhlinTownsend2007}, blah, blah blah...
\cite{DufloBanerjee2013}

\bibliography{test}

\end{document}

and the test.bib file

@article {AhlinTownsend2007,
author = {Ahlin, Christian and Townsend, Robert M.},
title = {Using Repayment Data to Test Across Models of Joint Liability Lending*},
journal = {The Economic Journal},
volume = {117},
publisher = {Blackwell Publishing Ltd},
number = {517},
pages = {F11-F51},
issn = {1468-0297},
doi = {10.1111/j.1468-0297.2007.02014.x},
url = {http://dx.doi.org/10.1111/j.1468-0297.2007.02014.x},
year = {2007},
}

@techreport{DufloBanerjee2013,
title={The miracle of microfinance? Evidence from a randomized evaluation},
author={Duflo, Esther and Banerjee, Abhijit and Glennerster, Rachel and Kinnan, Cynthia G},
year={2013},
institution={National Bureau of Economic Research},

}
DJJ
  • 335
  • Could you please complete your code to make a small document demonstrating the issue? That is much more useful than mere code fragments. – cfr May 04 '14 at 12:41
  • 1
    If I create a .bib file and add \cite{AhlinTownsend2007} plus \bibliographystyle{agsm}, I don't get any error. However, in general, hyperref should be loaded last, surely after harvard. – egreg May 04 '14 at 12:43
  • @cfr here is the complete code – DJJ May 04 '14 at 14:33

1 Answers1

2

I'm afraid I also cannot replicate the capacity-exceedance error you're reporting.

However, I have two suggestions -- both motivated by the fact that you're using the hyperref package -- which may be useful. Moreover, one of these suggestions involves using natbib instead of harvard. With this change, the capacity-exceedance error may also disappear on its own.

  • If you want a URL string to be an active hyperlink that users can click on, you should write the url field as

    url = {\url{http://dx.doi.org/10.1111/j.1468-0297.2007.02014.x}},
    

    instead of as

    url = {http://dx.doi.org/10.1111/j.1468-0297.2007.02014.x},
    
  • If you want the citation callouts in the body of the document to become hyperlinks to the corresponding entries in the bibliography, don't load the harvard citation management package. Instead, load the natbib citation management package and the auxiliary har2nat package. Since you're using the agsm bibliography style, which is part of the harvard package, it's necessary to load har2nat, as it provides macros that "translate" some of the harvard-specific macros into forms that natbib can process. (When switching from harvard to natbib/har2nat, it's generally necessary to delete all auxiliary files that were created during an earlier compilation run.)

In the example below, note that the natbib package is loaded with the option longnamesfirst in order to replicate the feature of the harvard package that the names of all authors should be provided the first time a given entry is cited. (Subsequent callouts to a given entry are typeset as FirstAuthor et al..) Separately, observe that one should encase the word Evidence in curly braces in order to keep it from being converted to all-lowercase.

enter image description here

\documentclass[english]{article}
\usepackage{filecontents} % make this a self-contained example
\begin{filecontents*}{test.bib} 
@article {AhlinTownsend2007,
  author = {Ahlin, Christian and Townsend, Robert M.},
  title = {Using Repayment Data to Test Across Models of Joint Liability Lending},
  journal = {The Economic Journal},
  volume = {117},
  publisher = {Blackwell Publishing Ltd},
  number = {517},
  pages = {F11-F51},
  issn = {1468-0297},
  doi = {10.1111/j.1468-0297.2007.02014.x},
  url = {\url{http://dx.doi.org/10.1111/j.1468-0297.2007.02014.x}},
  year = {2007},
}
@techreport{DufloBanerjee2013,
  title={The miracle of microfinance? {Evidence} from a randomized evaluation},
  author={Duflo, Esther and Banerjee, Abhijit and Glennerster, Rachel and Kinnan, Cynthia G},
  year={2013},
  institution={National Bureau of Economic Research},
}
\end{filecontents*}
\usepackage[margin=1.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{lmodern,textcomp} 
\usepackage{babel}
%%%\usepackage{harvard} 
\usepackage[longnamesfirst]{natbib} 
\usepackage{har2nat}                % emulate harvard-type macros for natbib
\bibliographystyle{agsm} % agsm is part of the "harvard" package
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[colorlinks=true,citecolor=blue]{hyperref}

\begin{document}
\dots as in \cite{AhlinTownsend2007}, blah, blah blah\dots
\cite{DufloBanerjee2013}

\bibliography{test}
\end{document}
Mico
  • 506,678
  • I'll consider this alternative. This post seems to contradict the right way to put url in a bib file. I am having a hard time finding the problem. I generally use Auctex on linux, there is no compilation problem. The problem arise only in Texwork on windows. – DJJ May 04 '14 at 15:07
  • Here is the post. – DJJ May 04 '14 at 15:15
  • 1
    @DJJ - I'm not sure what you mean by "the right way" to provide a URL. You certainly don't have to provide the \url instruction. However, if \url is omitted, the URL string will not be typeset as an active hyperlink. Moreover, overfull lines and other bad line break situations may occur if you omit the \url "wrapper", because LaTeX probably has no idea how to break a long URL string across lines. – Mico May 04 '14 at 15:15
  • @djj - which TeX distribution do you use on your windows machine, and how recently was it updated? – Mico May 04 '14 at 15:16
  • 1
    @djj - Thanks for the comment that provides a link to an earlier posting that was also contending with capacity-exceeded problems. However, AFAICT the PhDbiblio-url2 bibliography style (which was used in the earlier posting) and the agsm bibliography style (which is what you use) do not do the same things with the contents of the url field. I'd thus say you're safe using the \url wrapper macro. – Mico May 04 '14 at 15:22
  • your solution works fine and the Tex distribution I'm working with on Windows is Miktex 2.9 version: 0.4.3r.857. And thanks for the clarification about the post as well. I was chasing the wrong hare. – DJJ May 04 '14 at 15:32