if you write (with a pen) text with mixed arabic, numbers, english words. then somebody else gets to read it, he will read arabic from right to left, then when when he encouters a number or an english word, he will naturally jump to the first latin letter of the word and start reading left to right, then jump back to the beginning if the next arabic word and switch back to RTL. the alogorithm should copy that behaviour.