latex3 / babel

The multilingual framework to localize LaTeX, LuaLaTeX and XeLaTeX
https://latex3.github.io/babel/
LaTeX Project Public License v1.3c
130 stars 35 forks source link

\textdir TLT before tcolorbox in vertical and horizontal mode (layout=graphics) #146

Closed seloumi closed 2 years ago

seloumi commented 3 years ago

I have this example, arabic text inside tcolorbox if the box is inserted in vertical mode is fine but if the box is inserted in horizontal mode textdir inside the box become TLT (same with pardir)

https://tex.stackexchange.com/questions/615369/what-the-diff%c3%a9rence-in-construction-between-a-tcolorbox-with-width-linewidth

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage{tcolorbox}
\usepackage[bidi=basic,layout=graphics]{babel}
\babelprovide[import,main]{arabic}
\babelfont{rm}{Amiri}

\begin{document}

\noindent\begin{tcolorbox}[width=5cm] 
Text 
\the\textdir
\end{tcolorbox}

\begin{tcolorbox}
text
\the\textdir
\end{tcolorbox}

\end{document}

image

jbezos commented 3 years ago

Thank you. I'll resume the work on bidi writing and Arabic justification in a few weeks.

seloumi commented 2 years ago

Adding \bbl@pictresetdir to \tcb@savebox macro solve the issue

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage{tcolorbox}
\usepackage[bidi=basic,layout=graphics]{babel}
\babelprovide[import,main]{arabic}
\babelfont{rm}{Amiri}

\makeatletter
\bbl@sreplace\tcb@savebox{\ignorespaces}{\ignorespaces\bbl@pictresetdir}
\makeatother

\begin{document}

\noindent\begin{tcolorbox}[width=5cm,title=\the\textdir] 
Text 
\the\textdir
\end{tcolorbox}

\begin{tcolorbox}
text
\the\textdir
\end{tcolorbox}

\end{document}