下面两个示例的唯一区别在于第一个示例使用\ex
(显示示例编号),而第二个示例使用\exdisplay
(无示例编号)。 除此以外,它们完全相同。
两者都设置在parbox
环境中。正如您在 中看到的那样\ex
,示例编号位于页边距中,并且“文本”和行间注释之间出现间隙,就好像整个行间注释被推到了右侧。为什么会发生这种情况?
我希望将整个行间 + 示例编号推到左侧,以便所有内容都与示例一样具有边距\exdisplay
。乱七八糟地处理textoffset
并numoffset
没有产生预期的效果。
%XeLaTeX
\documentclass[11pt]{scrartcl}
\usepackage[showframe]{geometry}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\englishfont[Ligatures=NoCommon]{Linux Libertine O}
\usepackage{expex}
\lingset{glhangstyle=none}
\begin{document}
\section{Foo Bar}
This one has \verb=\ex=.
\noindent\makebox[\textwidth]{\parbox[t]{.29\textwidth}{
\exdisplay\noexno\strut\textenglish
text text text text text text text text text text text text text text text text .
\xe}\hfill
\parbox[t]{.69\textwidth}{\begin{hebrew}\ex\begingl
\gla אאאאא בבבבב גגגגג דדדדד ההההה ווווו זזזזז טטטטט //
\glb words words words word words words words words //
\glc words words words words words words words words //
\endgl\xe\end{hebrew}}}%
\noindent This one has \verb=\exdisplay=.
\noindent\makebox[\textwidth]{\parbox[t]{.29\textwidth}{
\exdisplay\noexno\strut\textenglish
text text text text text text text text text text text text text text text text .
\xe}\hfill
\parbox[t]{.69\textwidth}{\begin{hebrew}\exdisplay\begingl
\gla אאאאא בבבבב גגגגג דדדדד ההההה ווווו זזזזז טטטטט //
\glb words words words word words words words words //
\glc words words words words words words words words //
\endgl\xe\end{hebrew}}}%
\end{document}
答案1
我发现这个答案最有帮助。但它并不完美,因为行间行移到第二行太快,留下了一个很大的间隙,而这个间隙本应该几乎没有间隙(在我的 MWE 中)。但就这个问题而言,它已经足够接近了。
此外,我已通过电子邮件向expex
創作者要求他修复这个 RTL\ex
问题,使用这个 MWE 作为一个很好的起点。希望他有一个更完整的解决方案。
%XeLaTeX
\documentclass[11pt]{scrartcl}
\usepackage[showframe]{geometry}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\englishfont[Ligatures=NoCommon]{Linux Libertine O}
\usepackage{expex}
\lingset{glhangstyle=none}
\makeatletter
\def\ex@c{%
\ex@setup
\leavevmode
\setbox\numbox=\hbox{\hskip\lingnumoffset\ep@actualexnoprint}%
\epd@numright=\wd\numbox
\ifcase\ep@textanchor % numleft
\ep@settosum\leftskip\lingnumoffset\lingtextoffset
\or % normal
\ep@settosum\leftskip\epd@numright\lingtextoffset
\fi
% begin changes
% \llap{\hbox to\leftskip{\unhbox\numbox \hss}}%
\if@RTL
\hbox to\leftskip{\unhbox\numbox \hss}%
\else
\llap{\hbox to\leftskip{\unhbox\numbox \hss}}%
\fi
% end changes
\lingeveryex
\latex@tagex
\ignorespaces
}
\def\glw@begingl@a{%
\bgroup
\parindent0pt
\ep@setglstrut
\ifdim\ling@glwidth=0pt
\ifling@glossbreaking
\bgroup
\else
\vtop\bgroup
% begin changes
% \advance\hsize by -\leftskip
\if@RTL
\advance\hsize by -2\leftskip
\else
\advance\hsize by -\leftskip
\fi
% end changes
\advance\hsize by -\rightskip
\leftskip=0pt
\fi
\else
\vtop\bgroup
\hsize=\ling@glwidth
\leftskip=0pt
\fi
\bgroup
\parindent=0pt
\@glpreamblefalse
\@glftfalse
\let\mainlist=\empty
\let\itemtypelist=\empty
\let\aboveskiplist=\empty
\let\strutlist=\empty
\let\everylist=\empty
}
\makeatother
\begin{document}
\section{Foo Bar}
This one has \verb=\ex=.
\noindent\makebox[\textwidth]{\parbox[t]{.29\textwidth}{
\exdisplay\noexno\strut\textenglish
text text text text text text text text text text text text text text text text .
\xe}\hfill
\parbox[t]{.69\textwidth}{\begin{hebrew}\ex\begingl
\gla אאאאא בבבבב גגגגג דדדדד ההההה ווווו זזזזז ט //
\glb words words words word words words words w //
\glc words words words words words words words w //
\endgl\xe\end{hebrew}}}%
\noindent This one has \verb=\exdisplay=.
\noindent\makebox[\textwidth]{\parbox[t]{.29\textwidth}{
\exdisplay\noexno\strut\textenglish
text text text text text text text text text text text text text text text text .
\xe}\hfill
\parbox[t]{.69\textwidth}{\begin{hebrew}\exdisplay\noexno\begingl
\gla אאאאא בבבבב גגגגג דדדדד ההההה ווווו זזזזז טטטטט //
\glb words words words word words words words words //
\glc words words words words words words words words //
\endgl\xe\end{hebrew}}}%
\end{document}