Skip to content

Commit

Permalink
Make babel use more idiomatic
Browse files Browse the repository at this point in the history
* 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 jgm#7604
  • Loading branch information
hseg authored Oct 3, 2021
1 parent 6742e77 commit 3d8f011
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions data/templates/default.latex
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
$if(colorlinks)$
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
$endif$
$if(dir)$
$if(latex-dir-rtl)$
\PassOptionsToPackage{RTLdocument}{bidi}
$endif$
$endif$
$if(CJKmainfont)$
\PassOptionsToPackage{space}{xeCJK}
$endif$
Expand All @@ -17,9 +12,6 @@ $endif$
$if(fontsize)$
$fontsize$,
$endif$
$if(lang)$
$babel-lang$,
$endif$
$if(papersize)$
$papersize$paper,
$endif$
Expand Down Expand Up @@ -370,23 +362,28 @@ $if(csl-refs)$
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$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):
\let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{}
$endif$
$for(header-includes)$
$header-includes$
$endfor$
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
$if(dir)$
\ifXeTeX
% Load bidi as late as possible as it modifies e.g. graphicx
\usepackage{bidi}
\fi
\ifPDFTeX
\TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR}
Expand Down

0 comments on commit 3d8f011

Please sign in to comment.