Repository navigation
When Unicode bidi is not enough #441
jbezos
started this conversation in
Tips, tricks and more
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
When a document contains both left-to-right (LTR) and right-to-left (RTL) text,
lualatextogether withbidi=basiccan normally handle the text without any explicit directional markup. However, there are special cases where the desired interpretation cannot be obtained from the characters themselves and therefore require intervention.The basic and recommented mechanism is using
\foreignlanguage{...}{...}to explicitly establish the language and directional context of a piece of text. An alternative approach is inserting the control charactersLRMandRLM, i.e., invisible left-to-right or right-to-left mark at a particular boundary. Notebabeldoesn’t understand other control characters on purpose (Unicode UAX#9: “Where available, markup should be used instead of the explicit formatting characters”). See thebabelmanual for details.LRMandRLMcontrol characters can be inserted in a visible way with^^^^200eand^^^^200f. Sadly, these combinations can be displayed by editors in a somewhat weird way. On the other hand, some editors can also make the characters visible (for example, Notepad++). You may also define your own macros to insert them, according to your needs (e.g., you may prefer an active character).This article follows the examples in the W3C's Inline bidi markup examples, but expresses the solutions using
babel. The examples from the W3C are useful because they illustrate some situations in which the Unicode bidi may need additional information.The difficulty arises when characters do not themselves have a strong direction. Characters such as:
. , : ; ! ? ( ) + -are generally neutral and dependent on their surrounding context for bidi resolution.All reactions