I'm writing a document with lots of \hypertarget and \hyperlink in them using pdflatex.

I'm trying to get the text of

\hyperlink{label}{very long text that should line break}

to line break. Similarly with

\hyperref[label]{very long text that should line break}

I'm including hyperref with


unfortunately to no avail. How can I get the link text to line break?


hyperref's ocgcolorlinks option prevents line breaking inside the link text.

Use package ocgx2 instead. It allows longer link text to wrap around line and page breaks:


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.