更改单个段落中的字体 Arabxetex

更改单个段落中的字体 Arabxetex

我想知道如何在环境中只更改一个段落的字体\begin{arab}。我的默认字体设置如下\newfontfamily\arabicfont{Scheherazade},我还使用 polyglossia 包和 arabxetex。

答案1

这里有两种方法可以实现这一点。

最简单的方法是将段落放在单独的环境中,然后在环境之前arab更改定义,之后再更改回来。\arabicfontarab

(顺便说一句,我不知道阿拉伯语说什么,我从araxetex手册里抄了过来。)

最大能量损失 1:

\documentclass{article}
\usepackage{arabxetex}
\newfontfamily\scheherazadefont{Scheherazade}[Script=Arabic]
\newfontfamily\amirifont{Amiri}[Script=Arabic]
\let\arabicfont\scheherazadefont
\pagestyle{empty}
\begin{document}
\section*{Changing fonts between \texttt{arab} environments}
\begin{arab}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila
\end{arab}
\let\arabicfont\amirifont
\begin{arab}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila
\end{arab}
\let\arabicfont\scheherazadefont
\begin{arab}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila
\end{arab}
\end{document}

在此处输入图片描述

另一个选项是定义一个命令来更改arab处理编码的环境中的字体。我认为输出是相同的,但为了以防万一,我附上了屏幕截图。

最大能量损失 2:

\documentclass{article}
\usepackage{arabxetex}
\newfontfamily\arabicfont{Scheherazade}[Script=Arabic]
\newfontfamily\amirifont{Amiri}[Script=Arabic]
\makeatletter
\newcommand{\setarabfont}[1]{%
  #1
  \ifax@mode@defined%
    \ifx\@tempa\ax@mode@trans%
      \arabtex@codes\ax@trans@style%
      \addfontfeature{Mapping=arabtex-trans-\ax@trans@convention}%
    \else
      \ifx\@tempa\ax@mode@utf%
        \utf@fontfeature%
      \else
        \arabtex@codes%
        \addfontfeature{Mapping=arabtex-\@tempa}%
      \fi
    \fi
  \else
    \PackageWarning{arabxetex}{Mode \@tempa\ not defined, defaulting to \@ax@mode}%
    \arabtex@codes%
    \addfontfeature{Mapping=arabtex-\ax@mode}%
  \fi}
\makeatother
\pagestyle{empty}
\begin{document}
\section*{Changing fonts within the \texttt{arab} environment}
\begin{arab}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila

  \setarabfont{\amirifont}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila

  \setarabfont{\arabicfont}
  'amruN, 'ibiluN, 'u_htuN, '"u_ht"uN, '"Uql"Id"Is, ra'suN, 'ar'asu,
  sa'ala, qara'a, bu'suN, 'ab'usuN, ra'ufa, ru'asA'u, bi'ruN, 'as'ilaTuN,
  ka'iba, qA'imuN, ri'AsaTuN, su'ila, samA'uN, barI'uN, sU'uN, bad'uN,
  ^say'uN, ^say'iN, ^say'aN, sA'ala, mas'alaTuN, saw'aTuN, _ha.tI'aTuN,
  jA'a, ridA'uN, ridA'aN, jI'a, radI'iN, sU'uN, .daw'uN, qay'iN, .zim'aN
  , yatasA'alUna, 'a`dA'akum, 'a`dA'ikum, 'a`dA'ukum maqrU'aT, mU'ibAt,
  taw'am, yas'alu, 'a.sdiq^A'uh_u, ya^g^I'u, s^U'ila
\end{arab}
\end{document}

在此处输入图片描述

相关内容