5

I'm trying to add this to my bibliography:

\bibitem{nasa}Alliance, N.P.A.R.C. Computational fluid dynamics (CFD)  verification and validation web site: http://www.grc.nasa.gov/WWW/wind/valid/lamcyl/Study1_files/Study1.html

But it says:

! Missing $ inserted.

I have written other webpages without problem, for example:

\bibitem{lorenab} Lorena A. Barba group. CFD Python: 12 steps to Navier Stokes. http://goo.gl/yVI2zk

What is happening?

  • 1
    the problem is the underscore in the url. it's being interpreted as an indicator for a subscript. wrap the url with \url{...}; this will need a package such as hyperref. (i'm sure this has been answered before, but i can't find a reference.) – barbara beeton Feb 9 '16 at 18:17
  • @barbarabeeton I couldn't find a good duplicate either. The closest I got was The escape character before % is giving the ! Missing $ inserted. <inserted text> $ error, where I'm not too fond of the accepted answer. There is also Missing $ inserted issue. So you might as well go ahead and answer, you might want to mention that the url package is enough if one doesn't want hyper links as provided by hyperref. – moewe Feb 10 '16 at 8:37
8

the problem is the underscore in the url. it's being interpreted as an indicator for a subscript, which requires math. wrap the url with \url thus:

\url{http://www.grc.nasa.gov/WWW/wind/valid/lamcyl/Study1_files/Study1.html}

this will require a package. if you don't with to have hyperlinks, the url package will suffice.

\usepackage{url}

if you do wish to have hyperlinks, then use the hyperref package (which loads url). since this url is quite long, you may wish to allow it to be broken across lines; the breaklinks option will enable this:

\usepackage[breaklinks]{hyperref}

see the package documentation regarding the places where breaks are permitted.

the url package also has a (more complicated) line-breaking mechanism available. again, see the package documentation for details.

as reminded by @egreg, [breaklinks] works only if the output is dvi, to be converted by dvips and further converted to pdf by an additional tool.

  • 1
    Thank you very much. Just a small add-on: the hyperref package loads url internally, so there is really no need to load both. – moewe Feb 10 '16 at 14:57
  • @moewe -- thanks for that reminder. i've added it to the answer. – barbara beeton Feb 10 '16 at 15:03
  • @barbarabeeton breaklinks is only effective in latex+dvips+ps2pdf mode; with pdftex it's useless (but does no harm either). – egreg Feb 10 '16 at 15:10
  • @egreg -- i keep forgetting that (routinely use the dvips+distill method, which is more reliable when sent to the rip we use to make plates for the press). what, if anything, is a viable alternative? – barbara beeton Feb 10 '16 at 15:13
  • @barbarabeeton With pdflatex links are broken across lines; whether \url breaks or not, is another matter. – egreg Feb 10 '16 at 15:14

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.