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.

rugk
  • 1,090
  • 1
  • 10
  • 27

1 Answers1

1

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

Rmano
  • 40,848
  • 3
  • 64
  • 125