The unwanted vertical spacing is caused by the flushleft
environment. See this answer for a description.
New answer
Since we are patching a lot of commands, I’d recommend using the etoolbox
package. This approach makes your preamble code cleaner and easier to follow. And, you don’t need to copy the full original definition from cgloss4e.sty
to make your adjustments.
\documentclass{report}
\usepackage{xcolor}
\usepackage[english]{babel}
% Not needed for this problem
%\usepackage{polyglossia}
%\usepackage[AutoFallBack=true]{xeCJK}[2018/02/27]
%\setCJKmainfont[FallBack=SimSun-ExtB]{SimSun}
% Removed!
% Removed!
% Removed!
\usepackage{xpinyin}
\usepackage{gb4e}
\let\eachwordtwo=\pinyin
%\newcommand{\glit}[1]{\nobreak\glt {\it ``{#1}''}}
% I changed your original definition of \glit:
\newcommand{\glit}[1]{\glt ``\emph{#1}''\par}
\usepackage{etoolbox}% https://ctan.org/pkg/etoolbox
\makeatletter% Group everything to save the trouble
% My patches:
\patchcmd{\gll}% The command to be patched
{\begin{flushleft}}% Code to be replaced
{\begingroup\raggedright}% New code
{}{}
\patchcmd{\glll}% The command to be patched
{\begin{flushleft}}% Code to be replaced
{\begingroup\raggedright}% New code
{}{}
\patchcmd{\gl@stop}% The command to be patched
{\end{flushleft}}% Code to be replaced
{\endgroup}% New code
{}{}
% Your color customization:
\newcommand*\glosscolor[1]{\gdef\@glcolor{#1}}
\glosscolor{red}
\AtBeginDocument{\colorlet{savedcol}{.}}
\def\@glosscolor{savedcol}
\newcommand{\clt}{\gdef\@glosscolor{\@glcolor}\color{\@glosscolor}}
\newcommand{\clf}{\gdef\@glosscolor{savedcol}\color{\@glosscolor}}
% Your patch written in the style of \patchcmd:
\patchcmd{\getwords}% The command to be patched
{\strut#3}% Code to be replaced
{\strut\color{\@glosscolor}#3}% New code
{}{}
\gdef\donewords(#1,#2)\\{\gdef\@glosscolor{savedcol}}
\makeatother
\begin{document}
Normal spacing:
\begin{exe}
\ex
\glll
a \clt aaa \clf a aa ? \\
ni3 \clt wei4shen2me \clf xue2 Zhong1wen2 ? \\
You \clt why \clf study Chinese ? \\
\glit
{Why do you study Chinese?}
\ex
\glll
\clt aa \clf a a aa aa \\
\clt Yin1wei4 \clf wo3 zai4 Zhong1guo2 gong1zuo4 \\
\clt Because \clf I in China working \\
\glit
{Because I am working in China}
\end{exe}
Incorrect spacing (now corrected):
\begin{exe}
\ex
\glll
a \clt aaa \clf a aa ? \\
ni3 \clt wei4shen2me \clf xue2 Zhong1wen2 ? \\
You \clt why \clf study Chinese ? \\
\glit
{Why do you study Chinese?}
\glll
\clt aa \clf a a aa aa \\
\clt Yin1wei4 \clf wo3 zai4 Zhong1guo2 gong1zuo4 \\
\clt Because \clf I in China working \\
\glit
{Because I am working in China}
\end{exe}
\end{document}
Original answer
To get around this issue, I used a patch:
\makeatletter
\def\gll% % Introduces 2-line text-and-gloss.
{\begingroup\raggedright
\ifx\@gsingle1% conditionally force single spacing (hpk/MC)
\vskip\baselineskip\def\baselinestretch{1}%
\@selfnt\vskip-\baselineskip\fi%
\bgroup
\twosent
}
\def\glll% % Introduces 3-line text-and-gloss.
{\begingroup\raggedright
\ifx\@gsingle1% conditionally force single spacing (hpk/MC)
\vskip\baselineskip\def\baselinestretch{1}%
\@selfnt\vskip-\baselineskip\fi%
\bgroup
\threesent
}
\def\gl@stop{{\hskip -\glossglue}\unhbox\gline\endgroup}
\makeatother
To get proper paragraph break, I also changed your definition of \glit
:
\newcommand{\glit}[1]{\nobreak\glt {\it ``{#1}''}\par}
A full MWE:
\documentclass{report}
\usepackage{xcolor}
\usepackage[english]{babel}
% Not needed for your problem
%\usepackage{polyglossia}
%\usepackage[AutoFallBack=true]{xeCJK}[2018/02/27]
%\setCJKmainfont[FallBack=SimSun-ExtB]{SimSun}
% Removed!
% Removed!
% Removed!
\usepackage{xpinyin}
\usepackage{gb4e}
\let\eachwordtwo=\pinyin
%\newcommand{\glit}[1]{\nobreak\glt {\it ``{#1}''}}
% I changed your original definition
\newcommand{\glit}[1]{\nobreak\glt {\it ``{#1}''}\par}
\makeatletter
% My patches:
\def\gll% % Introduces 2-line text-and-gloss.
{\begingroup\raggedright
\ifx\@gsingle1% conditionally force single spacing (hpk/MC)
\vskip\baselineskip\def\baselinestretch{1}%
\@selfnt\vskip-\baselineskip\fi%
\bgroup
\twosent
}
\def\glll% % Introduces 3-line text-and-gloss.
{\begingroup\raggedright
\ifx\@gsingle1% conditionally force single spacing (hpk/MC)
\vskip\baselineskip\def\baselinestretch{1}%
\@selfnt\vskip-\baselineskip\fi%
\bgroup
\threesent
}
\def\gl@stop{{\hskip -\glossglue}\unhbox\gline\endgroup}
% Your patches:
\newcommand*\glosscolor[1]{\gdef\@glcolor{#1}}
\glosscolor{red}
\AtBeginDocument{\colorlet{savedcol}{.}}
\def\@glosscolor{savedcol}
\newcommand{\clt}{\gdef\@glosscolor{\@glcolor}\color{\@glosscolor}}
\newcommand{\clf}{\gdef\@glosscolor{savedcol}\color{\@glosscolor}}
\gdef\getwords(#1,#2)#3 #4\\% #1=linebox, #2=\each, #3=1st word, #4=remainder
{\setbox#1=\vbox{\hbox{#2{\strut\color{\@glosscolor}#3} }% adds space
\unvbox#1%
}%
\def\more{#4}%
\ifx\more\empty\let\more=\donewords
\else\let\more=\getwords
\fi
\more(#1,#2)#4\\%
}
\gdef\donewords(#1,#2)\\{\gdef\@glosscolor{savedcol}}
\makeatother
\begin{document}
Normal spacing:
\begin{exe}
\ex
\glll
a \clt aaa \clf a aa ? \\
ni3 \clt wei4shen2me \clf xue2 Zhong1wen2 ? \\
You \clt why \clf study Chinese ? \\
\glit
{Why do you study Chinese?}
\ex
\glll
\clt aa \clf a a aa aa \\
\clt Yin1wei4 \clf wo3 zai4 Zhong1guo2 gong1zuo4 \\
\clt Because \clf I in China working \\
\glit
{Because I am working in China}
\end{exe}
Incorrect spacing:
\begin{exe}
\ex
\glll
a \clt aaa \clf a aa ? \\
ni3 \clt wei4shen2me \clf xue2 Zhong1wen2 ? \\
You \clt why \clf study Chinese ? \\
\glit
{Why do you study Chinese?}
\glll
\clt aa \clf a a aa aa \\
\clt Yin1wei4 \clf wo3 zai4 Zhong1guo2 gong1zuo4 \\
\clt Because \clf I in China working \\
\glit
{Because I am working in China}
\end{exe}
\end{document}

Side note
SimSun
is a trademark of ZHONGYI Electronic Co., Beijing, which is licensed to Microsoft exclusively. Any use of SimSun
outside the Windows operating system may be considered as trademark infringement. If you want a “serif” looking CJK font, please consider using the Source Han Serif font released in 2017, which is free and open sourced. You can also download Source Han Serif from the Google Noto Fonts website.
If you want to use other open sourced CJK fonts, take a look at Open Source Fonts Collection for Chinese (website in HK Traditional Chinese, judging from the stroke of your 甚
character).
SimSun
is a trademark of ZHONGYI Electronic Co., Beijing, which is licensed to Microsoft exclusively. Please remove the download website information in your MWE.