0

This is a complement of my previous question What the difference (in construction) between a tcolorbox with width=\linewidth key and without it, I noticed that the issue appear if we add \textdir TLT or \pardir TLT before \setbox in vertical mode text inside box still in TRT direction unlike if we insert the two commands in horizontal mode

Is this a normal effect of primitives \bodydir, \textdir and \pardir or a luatex bug?

\documentclass{book}
\usepackage[showframe]{geometry}
\newbox\mybox
\parindent=0pt
    
\begin{document}
    
\pagedir TRT \pardir TRT \textdir TRT \bodydir TRT % with \bodydir TLT issue do not appear
    
{\textdir TLT  \setbox\mybox=\hbox{t:\the\textdir - p:\the\pardir - b:\the\bodydir} 
\box\mybox} 
    
\leavevmode% 
{\textdir TLT \setbox\mybox=\hbox{t:\the\textdir - p:\the\pardir - b:\the\bodydir} 
\box\mybox}
    
\end{document}

enter image description here

2
  • What is the issue you are investigating?
    – Cicada
    Sep 15, 2021 at 13:19
  • @Cicada textdir and pardir in the two boxes should be TLT but in the first box they are TRT
    – Salim Bou
    Sep 15, 2021 at 13:42

1 Answer 1

1

A proper answer will hopefully be given by those who know much about such things, but part of the answer has to do with when the command takes effect, e.g. after the current paragraph has completed, not during the paragraph.

Doing a \textdir TLT \pardir TLT\par\ instead of \textdir TLT \pardir TLT allows the following box to pick up those new directions.

vertical and horizontal

MWE

\documentclass{book}

\newbox\mybox
%\parindent=0pt

\begin{document}
All TRT:

\pagedir TRT \pardir TRT  \textdir TRT \bodydir TRT

\textdir TLT \pardir TLT \setbox\mybox=\hbox{First: t:\the\textdir; p:\the\pardir; b:\the\bodydir.} \box\mybox 

\ %<== Typeset a space = leave vertical mode 
\setbox\mybox=\hbox{Second:  t:\the\textdir; p:\the\pardir; b:\the\bodydir.} \box\mybox

\bigskip
All TRT, + mode switch after settings;

\pagedir TRT \pardir TRT  \textdir TRT \bodydir TRT

\textdir TLT \pardir TLT\par\  \setbox\mybox=\hbox{First: t:\the\textdir; p:\the\pardir; b:\the\bodydir.} \box\mybox 


\end{document}

Note that, of all the possible theoretical combinations of directions and elements (32, I think) in Omega, only real-world combinations (8?) were ported over into LuaTex, so expect some potential anomalies if you want to try out the others.

2
  • With \par\ we enter in horizontal mode same with second case using leavevmode
    – Salim Bou
    Sep 15, 2021 at 18:29
  • Yes. If the comment is a question: The paragraph commands (eg., pardir) take effect when: in the middle of a paragraph box, or on the next paragraph box? Looks like next. Correct? Just a guess. Any examples to the contrary?
    – Cicada
    Sep 16, 2021 at 6:40

You must log in to answer this question.

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