1

Similar to the URL problem: Forcing linebreaks in \url and URL latex linebreak
My links do cause an hbox overflow.

However, I have an \href with a local link. Can I force line breaks at any char there, too?

Code:

\newcommand*{\linkLocal}[1]{\href{run:./#1}{\texttt{#1}}}
\newcommand*{\linkLocalName}[2]{\href{run:./#1}{\texttt{#2}}}

So how can I force a line-breaking in \href similar to the solutions for url? I just want to break at all characters.

0

It seems that:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}
\usepackage{xurl}
\newcommand*{\linkLocal}[1]{\href{run:./#1}{\url{#1}}}
\newcommand*{\linkLocalName}[2]{\href{run:./#1}{\url{#2}}}
\begin{document}
\begin{minipage}{4cm}
    \linkLocal{very-long-and-strange-name-for_a_program.exe}
\end{minipage}
\end{document}

is doing the trick. Or I misunderstood the question?

enter image description here

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.