3

I need to hyphenate an URL —I'm the using \url{ } command)—. I've found that one solution is to add the hyphen option to the url package. I've added it but the compilation doesn't work. I get the following error:

! LaTeX Error: Option clash for package url.

Any solution?

Thanks in advance.

p.s The URL is contained in an entry of the bibliography. I don't know if this changes something. Here an example:

@misc{intro:naturaldisasters,
  title={The title},
  howpublished={\url{http://<URL TOO LONG>}},
  note={Accessed: YYYY-M-D}
}
  • First, you forgot to post the error message. Second, please provide an example code that shows the problem and can be run. – Manuel Weinkauf Jan 28 '15 at 10:26
  • If you use biblatex, it defines a url= field, which hyphenates urls correctly. – Bernard Jan 28 '15 at 10:28
  • @Bernard, I've put the URLs in the howpublished= field. – Gilberto T. Jan 28 '15 at 10:31
  • 1
    "Option clash" means that you are loading the package twice but with different options. – Ulrike Fischer Jan 28 '15 at 10:39
  • 2
    Check the log-file. It tells you where url is loaded. Or provide a minimal example. – Ulrike Fischer Jan 28 '15 at 11:33
2

Because you gave no MWE it is hard to give the right answer.

I guess that an other package in your code already has called package url, so that your \usepackage[hyphen]{url} results in a option clash (means url was called with different options).

Write the command \PassOptionsToPackage{hyphen}{url} in the line before \documentclass[...]{...}. Then your needed option hyphen is passed to package url when it is called.

Because you gave no MWE I can't say more, sorry.

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.