A demonstration of the problem by way of a minimal working example
I saved the following LaTeX code in the file ~/Test.tex.
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\the\textdir =%
\ifthenelse{\equal{\the\textdir}{TLT}}{TLT}{TRT}
\end{document}
The code prints out the content of the LuaTeX primitive \textdir register, an equality symbol, and then the string TLT if the contents of said register is TLT, and TRT otherwise.
I then executed the following commands in the Terminal.
> cd ~
> lualatex Test
As a consequence the file ~/Test.pdf was created. When opened in a PDF viewer, it showed "TLT=TRT".
Questions
If
\the\textdirexpands to the string "TLT", why, then, does the conditional evaluate to the else case "TRT"?How can I query the value of the
\textdirregister?
\jobnameand\stringit returns catcode 12 characters not catcode 11 – David Carlisle Dec 31 '22 at 11:28\xifthenelse{\streqtest{\the\textdir}{TLT}}{True}{False}will work (and, as a bonus, is fully expandable). – egreg Dec 31 '22 at 11:41\xifthenelsecauses a compilation failure, whereas\ifthenelseworks smoothely. – Evan Aad Dec 31 '22 at 11:54