我进行了修改\SH@restack
,以便它可以排版 RTL shapepar,但现在 shapepar 图形没有居中,谁能告诉我为什么?
\documentclass{article}
\usepackage[left=1cm,right=1cm]{geometry}
\usepackage{shapepar}
\usepackage{bidi}
\makeatletter
\def\SH@restack#1#2#3{% line num, shift, width
\unpenalty \skip@\lastskip \unskip \unpenalty
\advance\skip@\lastskip \unskip \unpenalty\unpenalty
\setbox\@tempboxa\lastbox
\setbox\SH@boxa\vbox{\hbox{\if@RTL\beginR\fi\vbox{%
\ifhbox\@tempboxa
\advance\SH@posold-#2% Trim box for \Shapepar
\moveright-\SH@posold \hbox to#3
{\hskip\leftskip \unhbox\@tempboxa \unskip \hskip\leftskip}%
\nobreak
\fi
\vskip\skip@
\ifnum\SH@nline>\z@ \begingroup
\count@=#1 \advance\count@-\SH@nline \advance\count@\@ne
\vskip-\count@\baselineskip
\endgroup\fi
\unvbox\SH@boxa}\if@RTL\endR\fi}}%
\SH@nline#1\relax
% Keep track of line num for last box (\SH@highline) and
% lowest box on page (\SH@lowline)
\ifnum\SH@highline=-\@m \SH@highline\SH@nline \fi
\ifnum\SH@lowline<\SH@nline \SH@lowline\SH@nline \fi
}
\makeatother
\begin{document}
\heartpar{%
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
}
\bigskip
\setRTL
\heartpar{%
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
}
\end{document}
答案1
“为什么”很简单,这是因为 TeX-XeT 非常简单。要查看问题,请试用演示
\documentclass{article}
\TeXXeTstate=1 %
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\beginR
ABC
\endR
\end{document}
使用 pdfLaTeX 或 XeLaTeX。请注意,RTL 段落位于“错误”的位置,如果您扩展它:
\documentclass{article}
\TeXXeTstate=1 %
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\beginR
\lipsum[1]
\endR
\end{document}
那么 parindent 也是如此。这一切都发生,因为\beginR
只反转了每个水平框在段落行中的填充方向,而不是它们相对于段落“轮廓”的位置。因此,通过shapepar
移动文本进行的计算朝向此处的左边距,不是离开。修复该问题需要对代码进行更多调整,但实际上只是为了突出 TeX--XeT 的问题。