14

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?

4
  • 2
    Have you loaded the url package?
    – Seamus
    Jan 6, 2012 at 8:58
  • Loading the hyperref should also work, i.e., make the command \url available.
    – Mico
    Jan 6, 2012 at 9:02
  • @Mico that's because hyperref loads url
    – Seamus
    Jan 6, 2012 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 Jan 6, 2012 at 9:16

1 Answer 1

18

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.

2
  • thanx a bunch :) Jan 6, 2012 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, 2018 at 15:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .