Make babel use more idiomatic

* Use `babel`'s bidi implementation
* Remove global `lang` option -- it broke eg hebrew
* Import babel languages individually instead of as package options --
  was broken for greek, hebrew
* Move `header-includes` to after `babel` setup

Closes #7604
This commit is contained in:
hseg
2021-10-04 02:34:59 +03:00
committed by GitHub
parent 6742e77d1e
commit 3d8f011004
+13 -16
View File
@@ -4,11 +4,6 @@
$if(colorlinks)$ $if(colorlinks)$
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} \PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
$endif$ $endif$
$if(dir)$
$if(latex-dir-rtl)$
\PassOptionsToPackage{RTLdocument}{bidi}
$endif$
$endif$
$if(CJKmainfont)$ $if(CJKmainfont)$
\PassOptionsToPackage{space}{xeCJK} \PassOptionsToPackage{space}{xeCJK}
$endif$ $endif$
@@ -17,9 +12,6 @@ $endif$
$if(fontsize)$ $if(fontsize)$
$fontsize$, $fontsize$,
$endif$ $endif$
$if(lang)$
$babel-lang$,
$endif$
$if(papersize)$ $if(papersize)$
$papersize$paper, $papersize$paper,
$endif$ $endif$
@@ -370,23 +362,28 @@ $if(csl-refs)$
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break} \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$ $endif$
$for(header-includes)$
$header-includes$
$endfor$
$if(lang)$ $if(lang)$
\usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} \ifXeTeX
\usepackage[bidi=default]{babel}
\fi
\ifLuaTeX
\usepackage[bidi=basic]{babel}
\fi
\babelprovide[main,import]{$babel-lang$}
$for(babel-otherlangs)$
\babelprovide[import]{$babel-otherlangs$}
$endfor$
% get rid of language-specific shorthands (see #6817): % get rid of language-specific shorthands (see #6817):
\let\LanguageShortHands\languageshorthands \let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{} \def\languageshorthands#1{}
$endif$ $endif$
$for(header-includes)$
$header-includes$
$endfor$
\ifLuaTeX \ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures \usepackage{selnolig} % disable illegal ligatures
\fi \fi
$if(dir)$ $if(dir)$
\ifXeTeX
% Load bidi as late as possible as it modifies e.g. graphicx
\usepackage{bidi}
\fi
\ifPDFTeX \ifPDFTeX
\TeXXeTstate=1 \TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR} \newcommand{\RL}[1]{\beginR #1\endR}