超連結內的換行符?

超連結內的換行符?

我的文檔中有一個命名連結。我想允許文字在任意位置換行,最好在一些常見的位置,但如果它不起作用,那麼在任何位置都行。

雖然對於該\url命令有一些軟體包(例如xurl),但在使用時我還沒有找到解決方案\hyperlink

\documentclass[a4paper,11pt,british]{article}
\usepackage[margin=2.5cm, showframe]{geometry}
\usepackage[tracking=true,factor=1100,stretch=10,shrink=10,final]{microtype} 
\usepackage{fontspec}
\directlua{luaotfload.add_fallback("fntFallback",{
    "DejaVu Sans:mode=harf",
    "NotoColorEmoji:mode=harf"})}
\setmainfont{Liberation Sans}
\usepackage{hyphenat}
\usepackage{xurl} 
\urlstyle{same}
\usepackage[pdfa, unicode, breaklinks]{hyperref}
\begin{document}
The labour participation rate in my own country is estimated to be 99.9\% in 2019 (%
\hyperlink{abc}{ILO/CSO/KRSO 2020})\newline
The labour participation rate in my own country is estimated to be 99.9\% in 2019 (%
\url{ILO/CSO/KRSO 2020})\newline

\hypertarget{abc}{sample anchor text}
\end{document}

在此輸入影像描述

我正在使用lualatex 1.17.0hyperref 2023-02-07 v7.00v.

答案1

您可以使用相同的換行符,\url例如

\hyperlink{abc}{\path{ILO/CSO/KRSO 2020}})

\path很像\url,但沒有建立連結。預設情況下它使用\texttt,但與\url您可以指定要使用的字體一樣,預設情況下它是透過定義的

\DeclareUrlCommand\path{\urlstyle{tt}}

相關內容