9

i want to add urls in my reference

i am using the following code in my .tex file

    \bibitem{bl}Business Logic layer, \url{http://en.wikipedia.org/wiki/Business_logic_layer}, 23 12 2011.

however, i get the following output in my console

    ! Undefined control sequence.
    l.477 \bibitem{bl}Business Logic layer, \url
                                        {http://en.wikipedia.org/wiki/Bu...

    ? 
    ! Missing $ inserted.
    <inserted text> 
            $
    l.477 ...rl{http://en.wikipedia.org/wiki/Business_
                                              logic_layer}, 23 12 2011.
    ? 
    ! Extra }, or forgotten $.
    l.477 ....wikipedia.org/wiki/Business_logic_layer}
                                              , 23 12 2011.
    ? 

    ! LaTeX Error: Command \item invalid in math mode.

whereas my .pdf file entry against this code is this.

    Business Logic layer,

http://en.wikipedia.org/wiki/Businesslogiclayer; 23122011

what is this error about and how can i set this right?

  • 2
    Have you loaded the url package? – Seamus Jan 6 '12 at 8:58
  • Loading the hyperref should also work, i.e., make the command \url available. – Mico Jan 6 '12 at 9:02
  • @Mico that's because hyperref loads url – Seamus Jan 6 '12 at 9:16
  • i m a newbee with latex so trying to learn its tricks, many a times the "how to do this" is not that descriptive. thanx – Arifah Azhar Jan 6 '12 at 9:16
13

To use the command \url you need to load the url package by adding \usepackage{url} to your preamble.

Many packages (like hyperref) load url automatically.

  • thanx a bunch :) – Arifah Azhar Jan 6 '12 at 9:14
  • Thanks. From my experience, to include a url in the bibitem block, hyperref didn't work whereas the url package did. I have no idea why. – Amir Sagiv Dec 10 '18 at 15:33

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.