![透過破壞 \href 來修復 hbox 溢位?](https://rvso.com/image/420050/%E9%80%8F%E9%81%8E%E7%A0%B4%E5%A3%9E%20%5Chref%20%E4%BE%86%E4%BF%AE%E5%BE%A9%20hbox%20%E6%BA%A2%E4%BD%8D%EF%BC%9F.png)
類似URL問題:在 \url 中強制換行和URL Latex 換行符
我的連結確實會導致 hbox 溢出。
但是,我有一個\href
本地連結。我也可以在任何字元處強制換行嗎?
代碼:
\newcommand*{\linkLocal}[1]{\href{run:./#1}{\texttt{#1}}}
\newcommand*{\linkLocalName}[2]{\href{run:./#1}{\texttt{#2}}}
那我怎麼才能強制換行,\href
類似 的解決方案url
?我只是想打破所有角色。
答案1
看起來:
\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}
正在做這個伎倆。還是我誤解了這個問題?