1

Original Question:
Trying to print one gloss level in expex in blue. The following gives me a "Missing \cr inserted" error:

\documentclass{article}
\usepackage{expex}
\usepackage{color}
\lingset{everyglc=\color{blue}}

\begin{document}
\ex \begingl
\gla Gloss this//
\glb black gloss//
\glc blue gloss//
\endgl \xe
\end{document}

Interestingly, when trying to color the glb line, i.e., the second to last gloss line via \lingset{everyglb=\color{blue} this works just fine. I've tried with custom defined gl-levels and it's always whatever the last gloss line happens to be that gives this error. It only happens with color, not with \bfseries for instance, or any other declaration.

I'm aware this is the same problem as this, but—as opposed to the solution there—I would prefer to define colors the way the color package handles colors which I use elsewhere in the document (with the dvipsnames option, not in the MWE).

Update:

The expex developer, John Frampton, has added color functionality to a pre-release version. Those interested in beta-testing should email him for the code. See answer below.

  • 1
    Possible duplicate of How to color each glb or fade in expex? – Jason Zentz Mar 29 '16 at 4:23
  • Thanks for pointing that out, I just checked, it's indeed the same problem, but I'd much prefer a solution via color package. Also, I don't use pdftex as suggested there. I've edited the question. (Do you think it's still a duplicate? And, if so, how would I "add" my case to the other question?) – jan Mar 29 '16 at 4:33
  • 2
    Ask the author to make the code "color safe". As it is there is imho neither some suitable hook nor sensible patch to do it. – Ulrike Fischer Mar 29 '16 at 8:08
  • 1
    I sent him a message. Will report back if he responds. – jan Mar 30 '16 at 1:23
1

Expex is now "color safe". The developer has kindly added multiple ways of dealing with colors starting with version 5.1.

The \textcolor command can now be used anywhere in any of the lines.

An option xyzcolor=colorname, where "xyz" is the name of the gloss line (such as gla, glb, or glpreamble) has also been provided whereby an entire line can be set to a given color (for example [glacolor=red]), globally or locally.

See below for some fairly self-explanatory examples of use. (The documentation hasn't been updated yet.)

\documentclass{article}
\usepackage{expex}
\usepackage{xcolor}

\begin{document}

\ex[glccolor=red] 
\begingl
\glpreamble \textcolor{cyan}{Comparison of numerals in various languages.}//
\gla \textcolor{blue}{English} one two three//
\glb \textcolor{blue}{German} ein zwei drei//
\glc \textcolor{blue}{Sanskrit} \'e-ka dv\'a tr\'\i//
\glb \textcolor{blue}{Irish} {a haon} {a d\'o} {a tr\'\i}//
\glft \textcolor{cyan}{This is where a free translation could go, if desired.}//
\endgl
\xe

\ex[glstyle=nlevel,glneveryline=,glspace=1.2em,glnlinecolors={,,red}]
\begingl
\glpreamble  Comparison of numerals in various languages.\endpreamble
\textcolor{blue}{English}[\textcolor{blue}{German}/\textcolor{blue}{Sanskrit}/
   \textcolor{blue}{Irish}]
one[eins/\'e-ka/a haon]
two[zwei/dv\'a/a d\'o]
three[drei/tr\'\i/a tr\'\i]
\glft This is where a free translation could go, if desired.
\endgl
\xe

\lingset{glftpos=right,glneveryline=}

\ex[glspace=1.2em,glccolor=red,everygla=]
Comparison of numerals in various languages.

\bigskip
\begingl
\gla \textcolor{blue}{English} one two three//
\glb \textcolor{blue}{German} ein zwei drei//
\glc \textcolor{blue}{Sanskrit} \'e-ka dv\'a tr\'\i//
\glb \textcolor{blue}{Irish} {a haon} {a d\'o} {a tr\'\i}//
\glft This is where a free translation could go, if desired.//
\endgl
\xe

\ex[glstyle=nlevel,glnlinecolors={,,red}]
Comparison of numerals in various languages.

\bigskip
\begingl[glnlinecolors={red,magenta,blue,green}]
\textcolor{blue}{English} [\textcolor{blue}{German}/\textcolor{blue}{Sanskrit}/   \textcolor{blue}{Irish}]
one[eins/\'e-ka/a haon]
two[zwei/dv\'a/a d\'o]
three[drei/tr\'\i/a tr\'\i]
\glft \textcolor{orange}{This is where a free translation could go, if desired.}
\endgl
\xe

\end{document}

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.