使用 URLRAW 在 URL 中添加阿拉伯字符

使用 URLRAW 在 URL 中添加阿拉伯字符

我引用了一个 URL 中包含阿拉伯字符的网站。为了避免引用中出现太多 %%%,我偶然发现了在 bib 项中添加字段 urlraw。但我在脚注和参考书目中得到的是: 脚注参考书目

这是 MWE

\documentclass[twoside,openright,12pt,a4paper]{report}
\usepackage{blindtext}
%%%Bookmarks%%%%
\usepackage[hidelinks,colorlinks=false,linkcolor=false,urlcolor=false,bookmarksopen=true]{hyperref}
\usepackage{bookmark}
\usepackage{scrextend}
%%%%language settings%%%%%%%%

\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\setotherlanguage{arabic}

%%%%Fonts%%%%%%%
\usepackage{fontspec}
\usepackage{lmodern}
\setmainfont[SmallCapsFont={Linux Libertine O C}]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.0,Mapping=arabicdigits,BoldFont=Amiri Bold]{Amiri}

%%%%biblatex%%%%%%
\usepackage{csquotes}
\MakeAutoQuote{»}{«}
\usepackage[backend=biber,notes, isbn=false,doi=false]{biblatex-chicago}
%%mention short title in subsequent citations%
\renewbibmacro*{cite:short:ibid}{%
  \usebibmacro{cite:short}{\thefield{entrytype}}}
%%%%%%%%%%%%%%%%
\begin{filecontents}{jobname.bib}
@online{ArsifMagalatAlmustaqbal,
  title = {Aršif maǧalat al-mustaqbal al-ʿarabī},
  url = {https://caus.org.lb/product-category/مجلة-المستقبل-العربي/},
  urlraw = {https://caus.org.lb/product-category/مجلة-المستقبل-العربي/},
  urldate = {2022-10-12},
  langid = {arabic},
  organization = {{Center for Arab Unity Studies}},
}
\end{filecontents}
\addbibresource{jobname.bib}
%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%URLRAW%%%%%%%%%%%%%%%%%%
\DeclareFieldFormat{url}{%
  \mkbibacro{URL}\addcolon\space
  \ifhyperref
    {\href{#1}{\nolinkurl{\thefield{urlraw}}}}
    {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter
     \nolinkurl
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter
       {\thefield{urlraw}}}}
%%%%%%%%%%%%%%%%%%
\begin{document}
\blindtext \autocite{ArsifMagalatAlmustaqbal}
\printbibliography[heading=bibintoc]
\end{document}

我该怎么做才能使阿拉伯字符正确显示在脚注和参考书目中?

答案1

建议的解决方案乌尔丽克·菲舍尔\sloppy对我来说很管用。我只需要在前面添加命令,\printbibliography这样 URL 就不会超出页面限制。这个 MWE 应该解释一下

\documentclass[twoside,openright,12pt,a4paper]{report}
\usepackage{blindtext}
%%%Bookmarks%%%%
\usepackage[hidelinks,colorlinks=false,linkcolor=false,urlcolor=false,bookmarksopen=true]{hyperref}
\usepackage{bookmark}
\usepackage{scrextend}
%%%%language settings%%%%%%%%

\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\setotherlanguage{arabic}

%%%%Fonts%%%%%%%
\usepackage{fontspec}
\usepackage{lmodern}
\setmainfont[SmallCapsFont={Linux Libertine O C}]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.0,BoldFont=Amiri Bold]{Amiri}

%%%%biblatex%%%%%%
\usepackage{csquotes}
\MakeAutoQuote{»}{«}
\usepackage[backend=biber,notes, isbn=false,doi=false]{biblatex-chicago}
%%mention short title in subsequent citations%
\renewbibmacro*{cite:short:ibid}{%
  \usebibmacro{cite:short}{\thefield{entrytype}}}
%%%%%%%%%%%%%%%%
\begin{filecontents}{jobname.bib}
@online{ArsifMagalatAlmustaqbal,
  title = {Aršif maǧalat al-mustaqbal al-ʿarabī},
  url = {https://caus.org.lb/product-category/مجلة-المستقبل-العربي/},
  urlraw = {https://caus.org.lb/product-category/مجلة-المستقبل-العربي/},
  urldate = {2022-10-12},
  langid = {arabic},
  organization = {{Center for Arab Unity Studies}},
}
\end{filecontents}
\addbibresource{jobname.bib}
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%URLRAW%%%%%%%%%%%%%%%%%%
\DeclareFieldFormat{url}{%
  \mkbibacro{URL}\addcolon\space
  \ifhyperref
    {\href{#1}{\arabicfont{\thefield{urlraw}}}}
    {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter
     \nolinkurl
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter
       {\thefield{urlraw}}}}
%%%%%%%%%%%%%%%%%%
\begin{document}
\clearpage
\tableofcontents

\clearpage
\blindtext \autocite{ArsifMagalatAlmustaqbal}
\sloppy
\printbibliography[heading=bibintoc]
\end{document}

相关内容