I have url-links which are quite long and might exceed a regular line width.
For "regular" long links with UTF-8 characters I have found the solution with the package xurl.
Since the URL characters might include as well Arabic characters I am facing the problem how to line break Arabic typeset text which is within an url?
\documentclass[a4paper,11pt,british]{article}
\usepackage[margin=2.5cm,showframe]{geometry}
\usepackage[tracking=true,factor=1100,stretch=10,shrink=10,final]{microtype}
\usepackage{fontspec}
\usepackage[shorthands=off,bidi=basic]{babel}
\directlua{luaotfload.add_fallback("fntFallback",{
"DejaVu Sans:mode=harf",
"NotoColorEmoji:mode=harf"})}
\setmainfont{Liberation Sans}
[RawFeature={fallback=fntFallback}
,SmallCapsFont={TeX Gyre Termes},SmallCapsFeatures={Letters=SmallCaps}% fonts for small caps
]
\babelprovide[import=ar]{arabic}
\babelfont[arabic]{rm}[Renderer=HarfBuzz, Language=Default]{Amiri}
\usepackage{xurl}
\urlstyle{same}
\usepackage[pdfa, unicode]{hyperref}
\hypersetup{
colorlinks={true},
urlcolor={blue},
}
\begin{document}
Al Sumaria News (25/7/2020): Najaf Water" explains the reasons for water scarcity in the
governorate",
{\selectlanguage{arabic}\url{https://www.alsumaria.tv/news/محليات/352690/ماء-النجف-توضح-أسباب-شح-المياه-في-المحافظة}}%
\end{document}
Remark:
- I'm looking for an automatic solution. Adding manual line breaks wouldn't lead to asking here.
- I'm using
lualatex 1.17.0

xurlI don't find any further clues how to solve this issue. – LeO Jan 20 '24 at 11:14