#StackBounty: #tikz-pgf #macros #right-to-left Create an adapted pgfpicture with fixed width for RTL context

Bounty: 100

This is a complement of my question Issue breakable box (tcolorbox package) with babel (layout=graphics)
the problem come from pgfpicture environment. here an example showing the issue

documentclass{article}
usepackage{pgf}
usepackage[showframe]{geometry}

parindent0pt

begin{document}

pagedir TRT pardir TRT textdir TRT bodydir TRT  

A {textdir TLTbegin{pgfpicture}{0pt}{0pt}{50pt}{3cm}
color{red}
pgfpathrectangle{pgfpointorigin}{pgfpoint{10cm}{2cm}}
pgfpathmoveto{pgfpointorigin}
pgfpathlineto{pgfpoint{10cm}{2cm}}
pgfusepath{stroke}
end{pgfpicture}} B    

end{document}

So with begin{pgfpicture}{0pt}{0pt}{50pt}{3cm} contents of environment appears on the margin one can use begin{pgfpicture}{0pt}{0pt}{textwidth}{3cm} to solve the issue but this need to be added inside tcolorbox package and this is not an easy task.

My question is there a solution which consist of redefining pgfpicture to allow a correct result in RTL context (pgfpicture contents in the page not outside).

enter image description here

Result in RTL context should look like this

enter image description here


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.