# “TeX capacity exceeded” with harvard package and url fields in bib file

When I try to compile the attached test document with MikTeX 2.9 updated to the latest packages, I get a

! TeX capacity exceeded, sorry [input stack size=5000].


error. I finally tracked down the error to be caused by the url line in the bib file, which my bib manager automatically produces. How can I fix this without manually removing all url lines (which I don't need most of the time, but I don't understand why they lead to the error)?

The commands I used for compilation are

pdflatex sa
bibtex sa
pdflatex sa


Please obtain the iopart class files from here (I used the PKZip version). I extracted all files from the zip to my project directory and followed the instructions from the documentation included in the same zip file:

• for alphabetic (Harvard) style reference we recommend that authors use the jphysicsB.bst BiBTeX style file together with the harvard LATEX package. jphysicsB.bst is supplied as part of the harvard.sty package which can be downloaded from www.ctan.org.

Source for sa.tex:

\documentclass[12pt]{iopart}
\usepackage{iopams}
\usepackage{harvard}

\begin{document}

test \cite{Hoo2009}.

\bibliographystyle{jphysicsB}
\bibliography{sa}

\end{document}


Source for sa.bib:

@ARTICLE{Hoo2009,
author = {Boo Hoo},
title = {Paper},
year = {2009},
url = {boo}
}

-
Where is a trusted source for iopart? –  egreg Mar 1 '12 at 18:29
@egreg I put the link in the question now. –  Szabolcs Mar 1 '12 at 18:32
Sorry, I don't get any error. The problem might be in the presence of an html.sty in your system. –  egreg Mar 1 '12 at 20:30
@egreg I remember that file was auto-downloaded by MikTeX when I compiled for the first time. Do you suggest removing it? –  Szabolcs Mar 1 '12 at 20:46

The problem is similar to the one raised in the question Why do hyperref and harvard not work together properly?

The biggest problem is that harvard.sty is quite old and it's unclear what html.sty it refers to. Currently TeX Live doesn't have an html.sty file, but you probably have one as part of latex2html (as stated in the http://www.ctan.org/pkg/latex2html page). What is certain is that the html.sty file provided by latex2html is incompatible with harvard.sty

Having an empty html.sty file in your working directory (as suggested in an answer) should solve the problem. Another strategy is to use natbib and har2nat:

\usepackage{natbib,har2nat}
\providecommand{\newblock}{}


(the second line probably has to do with the fact that iopart.cls doesn't define \newblock. The output should be very similar to the one produced by harvard.sty.

-