3

Is there any way to make examples written in gb4e appear ordered horizontally to each other, not vertically?

It should look like this:

1) a. Short example b. Short example c. Short example

instead of

1) a. Short example

b. Short example

c. Short example

0

1 Answer 1

6

A solution using multicol

You can use the multicol package to do this. The examples really do need to be quite small, though:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex\label{threeex}
\begin{multicols}{3}
\begin{xlist}
\ex A small example.
\ex Another small example.
\ex And a third one.
\end{xlist}
\end{multicols}
\end{exe}
\end{document}

output of code

However, a downside of this approach is that if you put more than 3 examples in a list, the way the multicol works will put the examples in an order you probably won't like:

output of code

A solution using tabularx

Since the multicol solution has severe limitations, I usually use a tabular environment for these kinds of examples. Here's a worked out example. It uses tabularx to create the table, and adds a command to increment the counter within the table.

The main limitation of this approach is that it won't work properly with glossed examples using the \gll macros. I don't know of any good way to do that.

Also, if you are using grammaticality judgement symbols like * you should enclose them like this \llap{*} so that they line up correctly.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tabularx}
\usepackage{array}
\usepackage{environ}
\usepackage{gb4e}

\newcolumntype{T}{>{\refstepcounter{tabenum}}X}
\newcounter{tabenum}[xnumi]
\renewcommand{\thetabenum}{\thexnumi\alph{tabenum}}
\newcommand*{\tabex}{\relax\alph{tabenum}.\quad}
\NewEnviron{multiexe}{%
    \setlength{\extrarowheight}{1ex}
    \begin{tabularx}{\linewidth}[t]{@{}TTT@{}}
       \BODY
    \end{tabularx}
}
\begin{document}

\begin{exe}
\ex\label{firstset}
\begin{multiexe}
\tabex A small example. &
\tabex Another small example. &
\tabex And a third one. \\
\tabex A fourth &
\tabex A fifth \label{foo1}&
\tabex A sixth
\end{multiexe}
\ex\label{secondset}
\begin{multiexe}
\tabex A small example. &
\tabex Another small example. &
\tabex And a third one.\label{foo2} \\
\tabex A fourth &
\tabex A fifth &
\tabex A sixth
\end{multiexe}
\end{exe}
 You can refer to examples (\ref{foo1}) and (\ref{foo2}).
\end{document}

output of code

1
  • The tabularx example is exactly what I needed. Thank you!
    – sgf
    Commented Jul 30, 2016 at 7:54

You must log in to answer this question.

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