This post is a follow up to my previous post. Here, I ask about two issues:
- Vertical spacing: How can I control the vertical spacing/padding in each of the cells? I would like to have full control, up to the point of complete elimination of the vertical spacing (marked with arrows in the figure below).
- Numbering: In addition, I would like for the parallel boxes to have automated numbering (and without producing indented text). In other words, each
twobywill be automatically numbered in the outer margin.
MWE:
\documentclass{book}
\usepackage{expex}
\usepackage{polyglossia}
\usepackage{fontenc}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{FrankRuehl}
\newfontfamily\englishfont{Times New Roman}
\lingset{
everygla=\Large, %some options are normalsize,large, Large, LARGE
everyglb=\scriptsize\englishfont\it,
everyglc=\scriptsize\englishfont,
glwordalign=center,
glhangindent=0em,
glrightskip=0pt
}
%here begins the code from https://tex.stackexchange.com/a/172887/121944
\usepackage{ifthen}
\usepackage{calc}
\usepackage{lipsum}
\makeatletter
\newcounter{tabindex}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{%
\@tabtoks\expandafter{\the\@tabtoks\stepcounter{tabindex}#1}}
\newcommand*\resettabtoks{\@tabtoks{}}
\newcommand*\synctabindex[1]{\setcounter{tabindex}{\value{#1}}}
\newcommand*\printtabtoks{\the\@tabtoks}
\makeatother
\def\colwidth{\textwidth}
\newcounter{sptstartrow}
\newcounter{sptendrow}
\newcounter{entries}
\newcounter{pagerows}
\newlength\CurrentTableHeight
\newlength\CurrentRowHeight
\newsavebox\pagerow
\newcommand\newspecialtable{%
\setcounter{sptendrow}{0}%
\setcounter{entries}{0}%
\setcounter{pagerows}{0}%
\setlength\CurrentTableHeight{0pt}%
}
\makeatletter
\newcommand\twoby[2]{%
\stepcounter{entries}%
\expandafter\def\csname entryX\roman{entries}Xa\endcsname{#1}%
\expandafter\def\csname entryX\roman{entries}Xf\endcsname{#2}%
\synctabindex{entries}%
\sbox{\pagerow}{\formatcol{a}\formatcol{f}}%
\setlength\CurrentRowHeight{\ht\pagerow+\dp\pagerow}%
\addtolength\CurrentTableHeight{\CurrentRowHeight}%
\ifdim\CurrentTableHeight>\textheight %
\makespecialtable[\thepagerows]%
\setcounter{pagerows}{0}%
\setlength\CurrentTableHeight{\CurrentRowHeight}%
\else\fi%
\stepcounter{pagerows}%
}
\makeatother
\newcounter{index}
\newcommand\makespecialtable[1][\theentries]{%
\setcounter{sptstartrow}{\thesptendrow}%
\addtocounter{sptendrow}{#1}%
\ifthenelse{\thesptendrow > \theentries}{\setcounter{sptendrow}{\theentries}}{}%
\clearpage
\setcounter{index}{\thesptstartrow}%
\synctabindex{index}
\resettabtoks%
\whiledo{\theindex < \thesptendrow}{%
\stepcounter{index}%
\addtabtoks{%
\csname entryX\roman{tabindex}Xa\endcsname &
\vphantom{\formatcol{f}}
\\%
\hline%
}%
}%
\begin{tabular}{|p{\colwidth}|@{\extracolsep{-\tabcolsep}}l}%
\hline%
\printtabtoks%
\end{tabular}%
\clearpage
\setcounter{index}{\thesptstartrow}%
\synctabindex{index}
\resettabtoks%
\whiledo{\theindex < \thesptendrow}{%
\stepcounter{index}%
\addtabtoks{%
\csname entryX\roman{tabindex}Xf\endcsname &
\vphantom{\formatcol{a}}
\\%
\hline%
}%
}%
\begin{tabular}{|p{\colwidth}|@{\extracolsep{-\tabcolsep}}l}%
\hline%
\printtabtoks%
\end{tabular}%
}
\newcommand\formatcol[1]{%
\parbox[t]{\colwidth}{\csname entryX\roman{tabindex}X#1\endcsname\strut}%
}
\newcommand\finishspecialtable{\makespecialtable}
\begin{document}
\centering
\newspecialtable
\twoby
{\exdisplay\footnotesize\textenglish{Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is the end} \xe}%
{\exdisplay\begingl
\gla אאאא בבבב גגגג דדדד אא בב גג דד אאאא בב גגגג דדד אאאא בבבבב גג דדדד אא בבבב גגגגג דדד //
\glb aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd //
\glc aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd //
\endgl \xe}%
\twoby
{\exdisplay\footnotesize\textenglish{Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is the end} \xe}%
{\exdisplay\begingl
\gla אאאא בבבב גגגג דדדד אא בב גג דד אאאא בב גגגג דדד אאאא בבבבב גג דדדד אא בבבב גגגגג דדד אאאא בבבב גגגג דדדד אא בב גג דד אאאא אאאא בבבב גגגג דדדד אא בב גג דד אאאא בב גגגג דדד אאאא בבבבב גג דדדד אא בבבב גגגגג דדד אאאא בבבב גגגג דדדד //
\glb aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd //
\glc aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd //
\endgl \xe}%
\twoby
{\exdisplay\footnotesize\textenglish{Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is some non lipsum text to fill up this space Here is the end} \xe}%
{\exdisplay\begingl
\gla אאאא בבבב גגגג דדדד אא בב גג דד אאאא בב גגגג דדד אאאא בבבבב גג דדדד אא בבבב גגגגג דדד אאאא בבבב גגגג דדדד אא בב גג דד אאאא //
\glb aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa //
\glc aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa bbb ggg ddd aaaa //
\endgl \xe}%
\finishspecialtable
\end{document}
UPDATE:
I finally figured out that I can control the vertical spacing with aboveexskip and belowexskip. Still need help with the automatic numbering of the parallel boxes/paragraphs.




\lingset{aboveexskip=-2pt, belowexskip=-7pt}, since the\exdisplayintroduces the vertical spacing. – Steven B. Segletes Nov 14 '17 at 12:23