5

Consider the following code

\TeXXeTstate=1

Hello World

\beginR Hello World\endR

\bye

Which produce the following document with either XeTeX or pdfTeX

enter image description here

Now, the out put of the following code is the same with pdfLaTeX

\documentclass{article}

\TeXXeTstate=1

\begin{document}

Hello World

\beginR Hello World\endR

\end{document}

But with XeLaTeX the output is

enter image description here

Is XeLaTeX implementing TeX--XeT differently? If so, why?

1

1 Answer 1

4

The LaTeX kernel loads the OpenType version of Latin Modern with XeTeX and LuaTeX. This causes XeTeX to use the HarfBuzz font shaper, and that doesn't really integrate with TeX--XeT. You can force loading of a classical 8-bit font, and the 'original' behaviour is restored:

\documentclass{article}
\usepackage[OT1]{fontenc}

\TeXXeTstate=1

\begin{document}

Hello World

\beginR Hello World\endR
\end{document}
9
  • 2
    Fundamentally, TeX--XeT is a problematic approach: we are working on helping people transition from XeTeX to LuaTeX as a result. See github.com/latex3/xxetex for current ideas.
    – Joseph Wright
    Jan 27, 2023 at 12:37
  • Thank you for the quick reply! LuaTeX has been developing fairly fast in the past few years and it indeed became a suitable alternative, I was just wondering out of curiosity about this phenomenon.
    – Udi Fogiel
    Jan 27, 2023 at 12:48
  • Does this happen with any OpenType font? I tried to load Times New Roman (without fontspec) and got the same behavior.
    – Udi Fogiel
    Jan 27, 2023 at 12:50
  • @UdiFogiel 'The same behaviour' - could you clarify what output you get?
    – Joseph Wright
    Jan 27, 2023 at 12:55
  • 1
    Slight correction, this is not related to HarfBuzz. When using “native” fonts (i.e. not TFM fonts), XeTeX will apply Unicode BiDi algorithm to chunks of text regardless of the TeX--XeT direction (here it is applied to every word separately, but with \XeTeXinterwordspaceshaping it will collect more text if it can). This seems to be intentional and predates the use of HarfBuzz. I assume it was so that short strings can get away without needing \beginR/\endR, etc. Feb 14, 2023 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .