bidi-longtable 中的小页面

bidi-longtable 中的小页面

我有一个bidi-longtable混合语言文档(mainlanguage阿拉伯语)。我在表格的每个单元格中使用了小页面,因为我稍后需要做一些复杂的事情,比如脚注。尺寸和可见边框和字体并不重要。

对我来说棘手的是单元格内的右/左对齐。此外,会longtable影响节标题。如果我用注释掉该部分longtable,则节标题的格式很好。但是,一旦我输入,节标题longtable就会奇怪地缩进。

我想实现这个目标: 图片

但我明白这一点:
图片

我的 MWE 表现不佳。我尝试过将它放在%一些行的末尾,因为这似乎是 TeX 中的一个魔法设置,但即使是这种黑暗魔法也无济于事。

为了使您的回答更有帮助,您能否解释一下为什么我的代码不起作用?

\documentclass{article}
\usepackage{longtable}
\usepackage{bidi-longtable}

\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.50]{Times New Roman}
\newfontfamily\englishfont[Script=Latin]{Times New Roman}
\setlength{\parindent}{0pt}
\begin{document}


\section{بببببب \\%
\mbox{}\hfill\textenglish{bbbbbbb}}%

\begin{Arabic}
كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 
كلمة كلمة كلمة كلمة كلمة .\end{Arabic}

\begin{english}
word word word word word word word word word word word word word 
word word word word word word word word word word word word 
\end{english}

\begin{longtable}{p{2in}|p{2in}}
\begin{minipage}{2in}
\begin{Arabic}
كلمة 
\end{Arabic}%

\raggedleft 
\begin{english}
word \end{english}
\end{minipage}%
&
\begin{minipage}{2in}
\begin{english}
word 
\end{english}
\end{minipage}%
\end{longtable}


\end{document}

答案1

该包bidi-longtable是实验性的;除了将其放入内部之外,TeX-XeT 算法中没有其他方法可以将表格材料制作成 RTL

\hbox{\beginR\vbox{...}\endR}

构造。这本身就有一系列问题,这些问题加起来就是 TeX--XeT 的限制。

显示该问题的最小示例是:

\documentclass{article}
\usepackage{lipsum}
\usepackage[RTLdocument]{bidi}
\setlength{\parindent}{0pt}
\begin{document}
\hbox{\beginR\vbox{%
\section{%
This is a test\\
\mbox{}\hfill\LRE{Another test}%
}%
}\endR}

\begin{LTR}
\lipsum[1]
\end{LTR}
\end{document}

问题是文件latex-xetex-bidi.def,重新定义\@hangform为:

\def\@hangfrom#1{\setbox\@tempboxa\hbox{{#1}}%
      \hangindent \if@RTL-\else\fi\wd\@tempboxa\noindent\box\@tempboxa}

这种重新定义是合乎逻辑的,但如果它最终出现在以下构造中:

\hbox{\beginR\vbox{...}\endR}

然后边距将相反。对于您的最小工作示例,我建议进行以下重新定义:

\documentclass{article}
\usepackage{longtable}
\usepackage{bidi-longtable}

\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.50]{Times New Roman}
\newfontfamily\englishfont[Script=Latin]{Times New Roman}
\setlength{\parindent}{0pt}

\makeatletter
\def\@hangfrom#1{\setbox\@tempboxa\hbox{{#1}}%
      \hangindent \wd\@tempboxa\noindent\box\@tempboxa}
\makeatother
\begin{document}


\section{بببببب \\%
\mbox{}\hfill\textenglish{bbbbbbb}}%

\begin{Arabic}
كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة كلمة 
كلمة كلمة كلمة كلمة كلمة .\end{Arabic}

\begin{english}
word word word word word word word word word word word word word 
word word word word word word word word word word word word 
\end{english}

\begin{longtable}{p{2in}|p{2in}}
\begin{minipage}{2in}
\begin{Arabic}
كلمة 
\end{Arabic}%

\raggedleft 
\begin{english}
word \end{english}
\end{minipage}%
&
\begin{minipage}{2in}
\begin{english}
word 
\end{english}
\end{minipage}%
\end{longtable}


\end{document}

请注意,这不是一个完美的解决方案;它只能解决您的问题,但会破坏软件包bidi

相关内容