1

Here's the code I'm working with (you need cgloss.sty to run it):

\documentclass[11pt]{article}
\usepackage{linguex}
\usepackage{cgloss}
\begin{document}

\ex. \ag. This is a sentence. \ a b c d\ \hfil{lalalala} \glt blah' \bg. This is a sentence. \\ a b c d\\ \hfil{lalalala} \gltblah'

\end{document}

It produces the following:

enter image description here

Is there a way to modify it to make it look something like this:

enter image description here

That is, I want to have a line with "Context" just above the lines that contain "This is a sentence" in my example. If I just use \\, this messes up the inter-linear glossing.

Alan Munn
  • 218,180

1 Answers1

1

Another reason not to use linguex. :) If you're not committed to it, I would recommend gb4e instead. But if you are committed to it, you can do what you want by using the cgloss4e glossing macros directly rather than the linguex wrappers.

Using linguex alone

Because linguex adds a small vertical space in the \ex. line, I've made a corresponding \ix. command to use when an example has the introduction line. If you like the small extra space (as in the second version of my sample code) then you don't need the \ix. command at all.

\documentclass{article}

\usepackage{linguex} \def\ix.{\ex.\setlength{\Extopsep}{0pt}} \begin{document} \ix. \a. This is an introductory sentence describing the context. \gll This is a gloss\ This is another gloss\ \glt `This is a translation.'

\ex. \a. This is an introductory sentence describing the context. \gll This is a gloss\ This is another gloss\ \glt `This is a translation.'

\end{document}

output of linguex code

Using linguex with cgloss

If you are also using cgloss, then the solution actually turns out to be simpler, we just need to add a zero length \vskip to the \gll command, which we can do using the etoolbox package.

\documentclass{article}

\usepackage{linguex,cgloss} \usepackage{etoolbox} \pretocmd{\gll}{\vskip0pt}{}{} \begin{document} \ex. \a. This is an introductory sentence describing the context. \gll This is a gloss\ This is another gloss\ \glt `This is a translation.'\hfill (Language information)

\end{document}

output of cgloss code

Alan Munn
  • 218,180
  • Thanks! What if some of my prior examples use cgloss.sty (in order to make hfill work properly)? This doesn't seem to work together with cgloss. Is there a way to either make it work with cgloss, or make hfill (or something similar) work without cgloss? – user125234 Apr 10 '22 at 00:00
  • Sorry I didn’t have cgloss installed on the machine I wrote the answer on and assumed it wouldn’t make a difference. I’ll take a look. – Alan Munn Apr 10 '22 at 00:01
  • The cgloss solution turns out to be simpler, and I've updated the answer but I've kept the linguex solution in the answer as well for those who might not be using cgloss. – Alan Munn Apr 10 '22 at 03:33
  • Thank you!! If the "introductory sentence" takes several lines, do you think any further modifications (in terms of spacing between those lines) are needed to make readability even better? (I'm thinking maybe if the spacing between the gloss and translation is the same as the spacing between the lines in the "introductory sentence", that could improve readability?) – user125234 Apr 10 '22 at 17:48
  • It might do. That's an aesthetic choice you have to make. But you can adjust the \vskip amount to something greater than 0pt. cgloss defines a \gltoffset macro (default is 0pt) which will put space between the gloss and the translation. If you you use \gltoffset as the value you use for the \vskip in the adjusted \gll command you can have equal space above and below. N.B. \gltoffset is a macro not a length, so you set it with \renewcommand{\gltoffset}{...} not \setlength. – Alan Munn Apr 10 '22 at 23:00