TransWikia.com

Conflict between babel-hebrew and arabi

TeX - LaTeX Asked by JSpitzm on January 7, 2021

Consider the following MWE:

documentclass[
    hebrew,% breaks
    farsi,% or arabic
%   hebrew,% compiles
    english]{article}

usepackage[LAE,LFE,T1]{fontenc}
usepackage[cp1255,utf8,latin9]{inputenc}

usepackage{babel}

begin{document}

Hello.

end{document}

This breaks with

! Argument of o@everypar has an extra }. <inserted text> 
                 par  l.126    n@everyparexpandafter{theo@everypar}

If hebrew is loaded after farsi, however, it compiles fine.

It seems to me this is due to a redfinition in rlbabel.def (used by Hebrew) that is incompatible with a redefinition in arabicore.sty (used by Farsi).

rlbabel.def has:

defrl@everypar{if@rl{setboxz@lastboxbeginRuseboxz@}fi}
leto@everypar=everypar
defeverypar#1{o@everypar{rl@everypar#1}}

and arabicore.sty:

defArabi@rl@everypar{if@rl{setboxz@lastboxbeginRuseboxz@}fi} 
   leto@everypar=everypar 
   newtoksn@everypar 
   n@everyparexpandafter{theo@everypar} 
   o@everypar{Arabi@rl@everyparthen@everypar} 
   leteverypar=n@everypar 

Am I right that the problem is the former definition which adds an argument to everypar? How could this be fixed most elegantly? Even if both packages haven’t seen updates for some time I’d like to submit a bug report, but I am not sure to which package. Hints very welcome.

(I know that one can use LuaTeX/XeTeX nowadays, but that’s not at stake here. I really try to help fixing this particular case)

EDIT: This would be my own humble attempt. This fixes compilation but I am not sure it really does what the original version did:

--- /tmp/meld-tmprm047c5p
+++ /home/juergen/texmf/tex/generic/babel/rlbabel.def
@@ -136,8 +136,11 @@
 def@ensure@R#1{if@rl#1elseR{#1}fi}
 def@ensure@L#1{if@rlL{#1}else#1fi}
 defrl@everypar{if@rl{setboxz@lastboxbeginRuseboxz@}fi}
-leto@everypar=everypar
-defeverypar#1{o@everypar{rl@everypar#1}}
+letrl@o@everypar=everypar
+newtoksrl@n@everypar
+rl@n@everyparexpandafter{therl@o@everypar}
+rl@o@everypar{rl@everypartherl@n@everypar}
+leteverypar=rl@n@everypar
 newcommand{hmbox}[1]{mbox{R{#1}}}
 newcommand{embox}[1]{mbox{L{#1}}}
 def@brackets#1#2#3{protectif@rl #3#2#1protectelse
@@ -289,7 +292,7 @@
        large bfseries #1hfil hb@xt@@pnumwidth{hss#2}}par
        nobreak
          global@nobreaktrue
-         everypar{global@nobreakfalseeverypar{}}%
+         defrl@everypar{global@nobreakfalseif@rl{setboxz@lastboxbeginRuseboxz@}fi}%
     endgroup
   fi}}}
 @ifclassloaded{article}{% article class

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP