在 expex 中使用颜色会出现“缺少 \cr”错误

在 expex 中使用颜色会出现“缺少 \cr”错误

原始问题:
尝试以expex蓝色打印一个光泽度级别。以下给出“缺少 \cr 插入”错误:

\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}

有趣的是,当尝试为线条着色时glb,即通过\lingset{everyglb=\color{blue}此方法为倒数第二条光泽线着色时,效果很好。我尝试使用自定义的 gl-level,但总是最后一个光泽线出现此错误。这种情况只发生在颜色上,而不会发生在\bfseries例如或任何其他声明上。

我知道这是同样的问题但是 - 与那里的解决方案相反 - 我更喜欢按照color包处理我在文档其他地方使用的颜色的方式来定义颜色(使用选项dvipsnames,而不是在 MWE 中)。

更新:

开发expex人员 John Frampton 添加了颜色功能预发布版本。有兴趣参加 beta 测试的人可以给他发电子邮件索取代码。请参阅下面的答案。

答案1

Expex 现在是“颜色安全的”。开发人员从 5.1 版开始添加了多种处理颜色的方法。

\textcolor现在可以在任意行中的任何位置使用该命令。

还提供了一个选项 xyzcolor=colorname,其中"xyz"是光泽线的名称(例如glaglbglpreamble),通过该选项可以将整条线设置为给定颜色(例如[glacolor=red]),全局或局部。

请参阅下面的一些相当不言自明的使用示例。(文档尚未更新。)

\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}

相关内容