The example number
in the expex
package can be adjusted horizontally with the numoffset
and textoffset
commands, as documented on page 11 of the documentation (links to PDF). But how can it be adjusted vertically (relative to the \gla
baseline? The commands aboveexskip
and belowexskip
do not adjust the example number
itself.
I would like the solution to work with both LTR and RTL languages.
%XeLaTeX
\documentclass{scrbook}
\usepackage{libertine}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Linux Libertine O}
\newfontfamily\englishfont{Linux Libertine O}
\usepackage{expex} %gloss package
\lingset{everygla=\LARGE}
% to fix RTL example number going into margin
\makeatletter
\def\beginskip{\if@RTL\rightskip\else\leftskip\fi}
\def\ex@c{%
\ex@setup
\leavevmode
\setbox\numbox=\hbox{\hskip\lingnumoffset\ep@actualexnoprint}%
\epd@numright=\wd\numbox
\ifcase\ep@textanchor
\ep@settosum\beginskip\lingnumoffset\lingtextoffset
\or
\ep@settosum\beginskip\epd@numright\lingtextoffset
\fi
\llap{\hbox to\beginskip{\unhbox\numbox \hss}}
\lingeveryex
\latex@tagex
\ignorespaces
}
\makeatother
\begin{document}
\noindent Left-to-right (LTR) example:
\ex\begingl
\gla Lorem ipsum //
\glb lorem ipsum //
\endgl\xe
\hfill Right-to-left (RTL) example:
\begin{hebrew}\ex\begingl
\gla לוראם איפסום //
\glb lorem ipsum //
\endgl\xe\end{hebrew}
\end{document}