This question is related to “Forcing linebreaks in \url
”. One of its answer is to pass the hyphens
option to the url package:
\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}
As I have my own class file, I adapted the commands to be:
\PassOptionsToPackage{hyphens}{url}
\RequirePackage{hyperref}
However, the line \PassOptionsToPackage{hyphens}{url}
is clashing on my side and I got this error message: Option clash for package url. \let
.
Then, I tried to replace that line with \requirePackage[hyphens]{url}
, but since hyperref
already defines implicitly url
, I got the error Option clash for package url. \RequirePackage
.
I even tried the hyperref
package option breaklinks=true
but this did not help and the latter is reported to only work with slashes not dashes like I want.
Any idea? What could be the issue, where do I need to look for? I don't understand, the aforementioned command is reported to work fine by others, while on my side this is not working.
Best Answer
After some time of debug, I finally found what was wrong or actually the package responsible for that malfunction. I was using BibLaTeX, and as the following minimal working examples prove it, we have to declare the line
\PassOptionsToPackage{hyphens}{url}
before BibLaTeX is declared.Working example, links packages are declared before :
Non working one, links packages are declared after :
Also, I was using menukeys and I realized the compilation was failing on the line
\PassOptionsToPackage{hyphens}{url}
if menukeys was declared beforehyperref
. Movingmenukeys
afterhyperref
solved the issue.Hope this could help others.