I am using the package gb4e to gloss a number of linguistic examples. Its main feature, is that it aligns the words in the original language with glosses.
I would like to be able to change the font/colour of some parts of the text so as to highlight those that are more important in a particular context.
Example. In the following example, the first line is how I currently imagine my ideal solution. Unfortunately, it does not work. The second line, instead, is my current solution: this works, but I have to repeat the command for every gloss and makes the source code less readable. The third line is a failed attempt to dodge the issue: grouping together several words doesn't work because it makes them part of the same gloss.
\documentclass{report}
\usepackage{color}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex \glll
a \color{blue} b c d \color{black} e f g\\
a {\color{blue} b} {\color{blue} c} {\color{blue} d} e f g\\
a {\color{blue} b c d} e f g\\
\end{exe}
\end{document}
output:
I am looking for a better solution which achieves the same result as the second line of the given example, but it does not make the source code so unreadable.
I am open to suggestions which do not involve the package gb4e, in case there exist better packages for dealing with this kind of situations.
edit: the ideal solution is something of the form
a \fromNowOnTextIsBlue b c d \fromNowOnTextIsBlackAgain e f g\\
that is, a way to change the colour "globally", so that it spans beyond the local scope. In fact, the package gb4e considers any command as a standalone gloss and thus it does not propagate its effect across subsequent words. Is that possible?
\newcommand
.\color{blue}
because it's a bit long? Because you can define a\newcommand
to shorten it. I have an answer ready that does it.