![LuaTeX \bodydir 和 \pagedir:有没有办法将它们从 TRT 切换回 TLT?](https://linux22.com/image/343933/LuaTeX%20%5Cbodydir%20%E5%92%8C%20%5Cpagedir%EF%BC%9A%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E5%B0%86%E5%AE%83%E4%BB%AC%E4%BB%8E%20TRT%20%E5%88%87%E6%8D%A2%E5%9B%9E%20TLT%EF%BC%9F.png)
\bodydir
到目前为止,我还没有找到一种方法,可以在不使用和原语的情况下,在从右到左模式下正确缩进标准列表环境\pagedir
,如下所示:—
\documentclass{article}
\begin{document}
\bodydir TRT
\pagedir TRT
desserts.\footnote{Would you have any?}
\begin{enumerate}
\pardir TRT
\textdir TRT
\item desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts.
\item desserts.
\begin{itemize}
\item desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts.
\begin{itemize}
\item desserts.
\end{itemize}
\item desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts.
\end{itemize}
\end{enumerate}
% \bodydir TLT
% \pagedir TLT
\pardir TLT
\textdir TLT
desserts.\footnote{Would you have any?}
\end{document}
注意,\bodydir
和都\pagedir
必须在列表环境之外设置;否则缩进会出现在左侧,这是错误的。
问题是,当我尝试设置\bodydir
并\pagedir
返回时,我遇到了麻烦TLT
。
至于上面的 mwe,它可以很好地编译,但是脚注规则向右刷新,而我希望将其向左刷新。
任何帮助将非常感激。
答案1
到目前为止,我还没有找到一种方法,可以在不使用 \bodydir 和 \textdir 原语的情况下,在从右到左模式下正确缩进标准列表环境,如下所示:—
您的意思是\pagedir
不是\textdir
?
LuaTeX 的 bidi 模型有太多错误,所以最好忘记\pagedir
和\bodydir
,只使用\pardir
和\textdir
。
这几乎是逐字逐句地从bidi
包中摘取的:
\documentclass{article}
\usepackage{lipsum}
\makeatletter
\def\list#1#2{%
\ifnum \@listdepth >5\relax
\@toodeep
\else
\global\advance\@listdepth\@ne
\fi
\rightmargin\z@
\listparindent\z@
\itemindent\z@
\csname @list\romannumeral\the\@listdepth\endcsname
\def\@itemlabel{#1}%
\let\makelabel\@mklab
\@nmbrlistfalse
#2\relax
\@trivlist
\parskip\parsep
\parindent\listparindent
\advance\linewidth -\rightmargin
\advance\linewidth -\leftmargin
\advance\@totalleftmargin \rightmargin
\parshape \@ne \@totalleftmargin \linewidth
\ignorespaces}
\def\itemize{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\list
\csname\@itemitem\endcsname
{\def\makelabel##1{\llap{##1}\hss}}%
\fi}
\def\@item[#1]{%
\if@noparitem
\@donoparitem
\else
\if@inlabel
\indent \par
\fi
\ifhmode
\unskip\unskip \par
\fi
\if@newlist
\if@nobreak
\@nbitem
\else
\addpenalty\@beginparpenalty
\addvspace\@topsep
\addvspace{-\parskip}%
\fi
\else
\addpenalty\@itempenalty
\addvspace\itemsep
\fi
\global\@inlabeltrue
\fi
\everypar{%
\@minipagefalse
\global\@newlistfalse
\if@inlabel
\global\@inlabelfalse
{\setbox\z@\lastbox
\ifvoid\z@
\kern-\itemindent
\fi}%
\box\@labels
\penalty\z@
\fi
\if@nobreak
\@nobreakfalse
\clubpenalty \@M
\else
\clubpenalty \@clubpenalty
\everypar{}%
\fi}%
\if@noitemarg
\@noitemargfalse
\if@nmbrlist
\refstepcounter\@listctr
\fi
\fi
\sRTLbox\@tempboxa{\makelabel{#1}}%
\global\setbox\@labels\hbox dir TRT{%
\unhbox\@labels
\hskip \itemindent
\hskip -\labelwidth
\hskip -\labelsep
\ifdim \wd\@tempboxa >\labelwidth
\box\@tempboxa
\else
\hbox to\labelwidth {\unhbox\@tempboxa}%
\fi
\hskip \labelsep}%
\ignorespaces}
\def\itemize{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\list
\csname\@itemitem\endcsname
{\def\makelabel##1{\hss\llap{##1}}}%
\fi}
\long\def\sRTLbox#1#2{\setbox#1\hbox dir TRT{%
\color@setgroup#2\color@endgroup}}
\makeatother
\pardir TRT
\textdir TRT
\begin{document}
\lipsum[1]
desserts.\footnote{Would you have any?}
\begin{enumerate}
\item desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts.
\item desserts.
\begin{itemize}
\item desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts.
\begin{itemize}
\item desserts.
\end{itemize}
\item desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts desserts desserts desserts desserts
desserts desserts desserts.
\end{itemize}
\end{enumerate}
desserts.\footnote{Would you have any?}
\end{document}