1

I am trying to reproduce part of the results from this question, but I get the following error ! LaTeX cmd Error: Command '\arabicfont' already defined!. I already downloaded the fonts and they are in my system.

\documentclass{article}
\usepackage[novoc]{arabluatex}
\linespread{1.25}
\newcommand{\sample}{\arb{الأفكار الخضراء عديمة اللون تنام بغضب}}% http://www.omniglot.com/language/phrases/colorlessgreenideas.htm
\begin{document}
Amiri: \sample% arabluatex defaults to Amiri

\newfontfamily\arabicfont[Script=Arabic]{Reem Kufi} Reem Kufi: \sample% https://github.com/khaledhosny/reem-kufi

\end{document}

How can I fix it?

BlackMath
  • 169
  • 1
    Redfine \arabicfont with \renewfontfamily\arabicfont[Script=Arabic]{Reem Kufi}. Better still: "Font setup Any Arabic font can be defined to be used with arabluatex. For example, assuming that fontspec is loaded, this line may be inserted in the preamble, just above the line that loads arabluatex: \newfontfamily\arabicfont{<fontname>}[Script=Arabic] where is the standard name of the Arabic font to be used. By default, if no Arabic font is selected, arabluatex will issue a warning message and attempt to load the Amiri font" (manual: texdoc arabluatex, s 2.1) – Cicada Oct 09 '21 at 14:26
  • The current arabluatex assumes only one font is being used (\arabicfont) and that it has been set by the user, otherwise it tries to load Amiri font; the package checks for this at the beginning of the document: \AtBeginDocument{\ifdefined\arabicfont\relax\else.... I see from the linked question that you have asked the package maintainer. – Cicada Oct 09 '21 at 14:41
  • @Cicada But I want to switch between fonts. For example, I have a cover page where I want to use one font, and then the the body with other fonts: titles one font, and the paragraphs yet another. This was supported as saw in the question I referenced above, but it seems no longer! – BlackMath Oct 09 '21 at 22:55
  • 1
    @BlackMath as said by @Cidada, use \renewfontfamily instead of \newfontfamily. You can do this as many times as you want. See here for more information on commands used to select fonts. Also, for utf Arabic, you should rather use \txarb instead of \arb. – Robert Alessi Oct 10 '21 at 07:07
  • @RobertAlessi Thank you. Now it's working. I actually didn't notice the difference (\renewfontfamily instead of \newfontfamily) in Cicada comment. – BlackMath Oct 10 '21 at 07:27

0 Answers0