2

The only difference between the two examples below is that the first one uses \ex (which displays an example number) and the second uses \exdisplay (no example number). They are otherwise exactly the same.

Both are set in a parbox environment. As you can see with \ex, the example number lands in the margin and a gap appears between the "text" and the interlinear, as if the whole interlinear gloss was pushed to the right. Why is this happening?

I would like the entire interlinear + example number pushed to the left so that everything is with the margins like the \exdisplay example. Messing around with textoffset and numoffset did not yield the desired effect.

%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}

enter image description here

1 Answer 1

1

I found this answer to be most helpful. It's not perfect though because the interlinear moves to the second line too soon and leaves a big gap where there should be almost no gap (in my MWE). But for the sake of this question it is close enough.

Additionally, I have emailed the expex creator to ask him to fix this RTL \ex issue, using this MWE as an excellent starting point. Hopefully he has a more complete solution.

%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}

enter image description here

You must log in to answer this question.

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