![光泽命令和空格](https://linux22.com/image/461399/%E5%85%89%E6%B3%BD%E5%91%BD%E4%BB%A4%E5%92%8C%E7%A9%BA%E6%A0%BC.png)
我的\coolgl{}{}
光泽cgloss4e
命令(的的克隆\twosent
,因此具有大括号分隔的参数并且与\hfill
-兼容),它会在输出中产生那些不需要的空格,而 会\gll
按照预期忽略它们?
\documentclass{article}
\usepackage{linguex}
\NewDocumentCommand{\coolglossaux}{mmmmm}{%
\setlength{\glossglue}{#1pt plus 2pt minus 1pt}%
\renewcommand{\eachwordtwo}{\rule[-#2ex]{0pt}{0pt}#3}%
\getwords(\lineone,\eachwordone)#4 \\%
\getwords(\linetwo,\eachwordtwo)#5 \\%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\global\setbox\gline=\hbox{%
\unhbox\gline\hskip\glossglue\vtop{%
\box\wordone\nointerlineskip\box\wordtwo%
}%
}%
\testdone%
\ifnotdone%
\repeat%
{\hskip -\glossglue}\unhbox\gline%
}
\ExplSyntaxOn
\NewDocumentCommand{\coolgl}{O{}mm}
{
\group_begin:
\keys_set:nn { coolgl } { #1 }
\coolgl:VVVnn
\coolgl_glue
\coolgl_space
\coolgl_style
{ #2 }
{ #3 }
\group_end:
}
\keys_define:nn { coolgl }
{
glue.tl_set:N = \coolgl_glue,
space.tl_set:N = \coolgl_space,
style.tl_set:N = \coolgl_style,
glue.initial:n = 1,
space.initial:n = 1.2,
style.initial:n = \small,
}
\cs_set_eq:NN \coolgl:nnnnn \coolglossaux
\cs_generate_variant:Nn \coolgl:nnnnn { VVV }
\ExplSyntaxOff
\begin{document}
\ex.
\a. \gll lorsqu'\kern0.01em il est~venu\\
when he came\\
\b. \gll un trompe- la- mort\\
a deceives-\kern0.01em the-\kern0.01em death\\
\ex.
\a. \coolgl{lorsqu'\kern0.01em il est~venu}{%
when he came}%
\b. \coolgl{un trompe- la- mort}{%
a deceives-\kern0.01em the-\kern0.01em death}%
\end{document}
答案1
两个输出示例的差异有两个原因。
两者都源于您的初始设置定义:
\keys_define:nn { coolgl }
{
glue.tl_set:N = \coolgl_glue,
space.tl_set:N = \coolgl_space,
style.tl_set:N = \coolgl_style,
glue.initial:n = 1, % Here, you're explicitly setting an additional 1mm of glue
space.initial:n = 1.2,
style.initial:n = \small, % Here, you're changing the text size of the second line.
}
这两个因素结合起来,使得两个输出之间的片段比对不同。如果你将它们更改为
glue.initial:n = 0,
和style.initial:n = \normalsize,
那么你的片段将是相同的(至少在我看来)。
我对 LaTeX 3 语法不是很熟悉,所以我不能建议对宏定义本身进行更有针对性的更改。