4

I would like to use the package gb4e to produce glossed example with bracket, but I don't know which part is incorrect.

\begin{exe}

\ex 

\gll \lb{ }Zhangsan zhidao \lb{ } Lisi taoyan ziji. ]]\\

           Zhangsan knows Lisi dislikes self. \\

\glt     `Zhangsan knows that Lisi dislikes himself.'

\end{exe}

enter image description here

1
  • I would like to create something like '[Zhangsan zhidao [Lisi taoyan ziji]]'
    – Lee12138
    Mar 31, 2021 at 20:10

1 Answer 1

6

The \ex command assumes an optional argument for the grammaticality judgement, so your example needs to be enclosed in braces, otherwise the [ will be treated as the grammaticality judgement. There are two cases to consider:

For examples without a grammaticality judgement, it's sufficient to enclose the example sentence in braces, as in (1).

However, for examples that have a grammaticality judgement (even if empty), you will need to protect the opening [ somehow for it to be displayed as shown in (2). This is a bit of a quirk of gb4e (some might say a bug).

There are various ways you can protect the initial [ in examples with grammaticality judgements. In (3) I've put braces around the bracket. In (4) I've added \relax before the bracket. In (5) because of the \gll command, no protection is needed (but the whole example sentence needs to be in braces.

\documentclass{article}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex{[This] is an example which displays properly.}
\ex[*]{[This] is an example which doesn't display properly.}
\ex[*]{{[}This] is an example which does display properly.}
\ex[*]{\relax[This] is an example that works too.}
\ex[*]{\gll [This] is a glossed example\\
            [This] is a glossed example\\}
\end{exe}
\end{document}

output of code

You must log in to answer this question.

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