8

I'm writing my PhD thesis on linguistics using gb4e. In a number of cases I want to add a preamble line to an interlinear example and in some other cases I need a tabbing environment embedded within the examples (primarily for the counter). In principle this works fine, but gb4e introduces an unnecessary space before the \gll line. I've searched all over the internet and found no solution to this. My examples are too numerous to switch to another package such as expex. I've also tried using cgloss.sty, but this messes up some of my longer interlinear examples.

Here's a MWE:

\documentclass{scrbook}   
\usepackage{gb4e}  
\usepackage{lipsum}  
\begin{document}  

\lipsum[1] 

\begin{exe}  
\ex \gll bloss ein Beispiel\\  
just a example\\  
\glt \lq Just an example' 

\ex Swahili:  
\gll m-toto a-na-cheza\\  
1-child 1-\textsc{prog}-play\\  
\glt \lq A/the child is playing'  

\ex Some Swahili verb stems:  
\begin{tabbing}  
xxxxx\=\kill  
\textit{cheza}\>\lq play; dance'\\  
\textit{jua}\>\lq know'\\  
\textit{fika}\>\lq arrive'  
\end{tabbing}   
\end{exe}  

\lipsum[2]  
\end{document}

output

So what I want is to have a line break without any extra space between "Swahili" and the interlinear example in (2) and between "Some Swahili verb stems" and the following list in (3) respectively. I'll be really thankfull for any help!

  • Though the question asks specifically for a gb4e solution, I'd personally also be interested in solutions for other popular packages like linguex and expex. – hftf Jul 21 '15 at 17:05
  • Welcome to TeX.SX! – Ruben Jul 21 '15 at 17:16
8

1. With gb4e, cgloss, and tabular

I think the simplest way to fix the vertical spacing issue is to load the cgloss package and switch to a tabular environment instead of tabbing.

The cgloss package is not available on CTAN or in standard distributions; see Alan Munn's answer to Why is the gap between the translation and the last line of the gloss so wide in my interlinear gloss? for information about how to download and install it. You mention that you have tried this but it caused problems for longer examples; perhaps you should ask a separate question about that, or modify your MWE so that we have some of those longer examples to work with.

Unless you have a good reason to use tabbing, it's much more common to use tabular.

Code

\documentclass{scrbook}   
\usepackage{array} % for formatting tabular columns
\usepackage{gb4e}
\usepackage{cgloss}  % reduces vertical space between preamble and gloss lines, as well as between gloss lines and free translation lines

\begin{document}  

\begin{exe} 

\ex \gll bloss ein Beispiel\\  
just a example\\  
\glt \lq Just an example' 

\ex Swahili:\\
\gll m-toto a-na-cheza\\  
1-child 1-\textsc{prog}-play\\
\glt \lq A/the child is playing'  

\ex Some Swahili verb stems:\\ % with tabular, just using a normal line break (\\) gives the right spacing
\begin{tabular}[t]{@{}>{\itshape}ll} % the @{} removes horizontal spacing before the start of the tabular, >{\itshape} specifies that the next column is italics, and ll give you two left-aligned columns
cheza & \lq play; dance' \\
jua & \lq know' \\
fika & \lq arrive' \\
\end{tabular}

\end{exe}  

\end{document}

Output

enter image description here

2. With gb4e and tabbing but not cgloss

If you really can't make cgloss work and you really want to use tabbing, here are some hacks to make that work:

  • The new pream command gives you your colon and removes some vertical space.
  • When you have a preamble line and cgloss isn't loaded, gb4e adds extra space before the \glt line, so the new \pglt command removes some vertical space before calling the \glt command.

Code

\documentclass{scrbook}   
\usepackage{gb4e}
\newcommand{\pream}[1]{#1:\\[-4.5ex]} % for preamble lines, supplies a colon and removes some vertical space
\newcommand{\pglt}{\vspace*{-2ex}\glt} % for use in examples that have a preamble

\begin{document}  

\begin{exe} 

\ex \gll bloss ein Beispiel\\  
just a example\\  
\glt \lq Just an example' 

\ex \pream{Swahili} % put your preambles in the \pream{} command
\gll m-toto a-na-cheza\\  
1-child 1-\textsc{prog}-play\\
\pglt \lq A/the child is playing' % when a glossed example has a preamble, use \pglt instead of \glt

\ex \pream{Some Swahili verb stems}
\begin{tabbing}  
xxxxx\=\kill  
\textit{cheza}\>\lq play; dance'\\  
\textit{jua}\>\lq know'\\  
\textit{fika}\>\lq arrive'  
\end{tabbing}   

\end{exe}  

\end{document}

Output

enter image description here

3. With expex

User hftf asked in the comments about how to achieve this using other packages. The expex package provides an optional \glpreamble line within gloss environments, as well as a parameter belowglpreambleskip for how much vertical space separates this line from the gloss lines (see aboveglftskip in expex linguistic glosses for more about this). The package is very flexible; virtually anything you might want to tweak about example/gloss formatting is easy to do with the key-value options provided.

Code

\documentclass{scrbook}   
\usepackage{array} % for formatting tabular columns
\usepackage{expex}
\lingset{ % sets expex options
    everygla=, % top line of gloss is not italics
    belowglpreambleskip=-0.5ex, % removes some vertical space between the preamble and gloss lines
    aboveglftskip=-0.5ex % removes some vertical space between the gloss and free translation lines
}

\begin{document}  

\ex
    \begingl
    \gla bloss ein Beispiel //
    \glb just a example //
    \glft \lq Just an example' //
    \endgl
\xe

\ex~ 
    \begingl
    \glpreamble Swahili: //
    \gla m-toto a-na-cheza //
    \glb 1-child 1-\textsc{prog}-play //
    \glft \lq A/the child is playing' //
    \endgl
\xe

\ex~ Some Swahili verb stems:\\
    \begin{tabular}[t]{@{}>{\itshape}ll} % the @{} removes horizontal spacing before the start of the tabular, >{\itshape} specifies that the next column is italics, and ll give you two left-aligned columns
    cheza & \lq play; dance' \\
    jua & \lq know' \\
    fika & \lq arrive' \\
    \end{tabular}
\xe

\end{document}

Output

enter image description here

4. With linguex

Because linguex uses cgloss4e underlyingly just as gb4e does, the fix is very similar to gb4e's. Switching to cgloss will mean that you can't use the shorthand \exg. environment provided by linguex without using \glt to introduce the free translation line. As far as I know, there's no way to use \exg. with a preamble anyway, so it may be simplest to just use \ex. for every example and bring in \gll and \glt when you need glossing.

Code

\documentclass{scrbook}   
\usepackage{array} % for formatting tabular columns
\usepackage{linguex}
\usepackage{cgloss}  % reduces vertical space between preamble and gloss lines, as well as between gloss lines and free translation lines

\begin{document}  

\exg. bloss ein Beispiel \\  
just a example \\  
\glt \lq Just an example' % won't work without the \glt

\ex. Swahili:\\
\gll m-toto a-na-cheza\\  
1-child 1-\textsc{prog}-play\\
\glt \lq A/the child is playing'  

\ex. Some Swahili verb stems:\\ % with tabular, just using a normal line break (\\) gives the right spacing
\begin{tabular}[t]{@{}>{\itshape}ll} % the @{} removes horizontal spacing before the start of the tabular, >{\itshape} specifies that the next column is italics, and ll give you two left-aligned columns
cheza & \lq play; dance' \\
jua & \lq know' \\
fika & \lq arrive' \\
\end{tabular}

\end{document}

Output

enter image description here

  • 2
    Great answer, Jason! I was about to add one, but you've covered all the bases. – Alan Munn Jul 21 '15 at 18:50
  • 1
    Thanks for the great and very extensive answer, Jason! I think many people will benefit from this. – user82352 Jul 21 '15 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.