latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
124 stars 34 forks source link

\bbl@pictsetdir\tw@ instead of \bbl@pictsetdir\z@ to patch tikzpicture #211

Closed seloumi closed 1 year ago

seloumi commented 1 year ago

https://github.com/latex3/babel/blob/80b661afc0bd8aed1c2ae50bce11f4721182bb59/babel.dtx#L15101

With layout=graphics the attached example gives wrong result replacement is required to obtain correct result

\documentclass{article}
\usepackage{tikz}
\usepackage[bidi=basic,layout=graphics]{babel}
\babelprovide[import=ar-DZ,main]{arabic}

\babelfont{rm}{Amiri}

%\makeatletter
%\AddToHook{env/tikzpicture/begin}{\bbl@pictsetdir\tw@}%
%        \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}%
%        \bbl@sreplace\tikz{\begingroup}{\begingroup\bbl@pictsetdir\tw@}%
%\makeatother

\begin{document}

اليمين%
\begin{tikzpicture}
\draw (0,0) rectangle (3,2);
\end{tikzpicture}%
اليسار.  
\end{document}