9

I got the problem, that links in \url only break in LyX when there is a \ character in it. I found the solution to add \usepackage[hyphens]{url} to my preamble.

But the problem is, LyX loads the package url with no options, and I get an error. How can I solve this?

  • Welcome to TeX.SX! I believe you can somehow modify the document preamble in LyX (I've never used it so I don't know the details). You can add the line \PassOptionsToPackage{hyphens}{url} before \documentclass and you should be fine :) – yo' Oct 30 '13 at 13:40
  • I tried, doesn't seem to work... Perhaps my solution isn't right. – uloco Oct 30 '13 at 13:45
  • 1
    @tohecz I don't think you can add anything before \documentclass in LyX. You can add options to the document class however, which will also pass it to all packages (right?). – Torbjørn T. Oct 30 '13 at 13:49
  • @TorbjørnT. Jees, all options to class are passed to all packages as well, as long as the packages are loaded after the class. – yo' Oct 30 '13 at 13:51
  • 1
    Can you illustrate your problem via an example? Adding a screenshot of your LyX editor interface (or a link to the screenshot) would help. Also, when I add \usepackage[hyphens]{url} in the LaTeX Preamble in LyX, the option is loaded correctly. – Herr K. Oct 30 '13 at 16:37
3

A workaround for this problem would be to add hyphens to the document class options, in Document --> Settings --> Document class. Any options added to the document class will also be applied to all packages loaded later.

1

According to this answer, LyX 2.2 now supports putting into Document > Settings > Local Layout:

PackageOptions url hyphens

I have successfully used this with todonotes, but haven't tried it with your specific problem.

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.