1

Are there any LaTeX commands provided either by LaTeX, or by the article class, or by the babel package, or by the luatex engine, or else by some other babel+luatex compatible package, that enable a piece of LaTeX code to dynamically determine answers to the following questions:

  1. Is the text flow at the current location directed from left to right as in English, or from right to left as in Hebrew?

  2. Is the text flow of the current paragraph directed from left to right or from right to left? (This would be different than the answer to the 1st question when the current location is inside a short Hebrew quote embedded in an English paragraph.)

  3. Does the text flow of the main language at the current location have a left to right directionality or a right to left directionality? (This would be different than the answer to the 2nd question when the current location is inside a Hebrew paragraph that is embedded in an otherwise English text.)

I'm especially interested in the first of these questions.

Evan Aad
  • 11,066
  • 1
    In bidi there are two conditionals just for that. \if@RTL is true inside RTL mode and false outside. \if@RTLmain is true if the main direction of the document is RTL, otherwise false – Udi Fogiel Dec 31 '22 at 09:56
  • @UdiFogiel As far as I know, bidi is not babel+luatex compatible. – Evan Aad Dec 31 '22 at 10:03
  • 1
    the various registers relevant with luatex are described here https://tex.stackexchange.com/a/351558/2388. You can query the value of such a register with \the\textdir or \showthe\textdir. – Ulrike Fischer Dec 31 '22 at 11:19
  • @UlrikeFischer Thank you. This was helpful. – Evan Aad Dec 31 '22 at 11:58
  • 1
    You can also you the corresponding number registers \textdirection, \pardirection, etc. The number is 0 for LTR and 1 for RTL. – Udi Fogiel May 27 '23 at 14:49

0 Answers0