\def\EPGL@version{0.7}
\def\EPGL@date{2023/08/17}
% expex-glossonly is a package which allows gb4e and linguex users to use the glossing macros
% of the ExPex package, while still using the standard example and subexample numbering macros of
% those respective packages.
%
% Copyright 2016-2023 by Alan Munn
%
% This package may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This package has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this package is Alan Munn.
%
% This package consists of the file expex-glossonly.sty and documentation files
% expex-glossonly.tex and expex-glossonly.pdf plus two test files: gb4e-expex.tex and linguex-expex.tex
%
% This package is currently experimental. Use at your own risk.
%
\ProvidesPackage{expex-glossonly}[\EPGL@date\ Compatibility package for using ExPex glosses with other example packages v. \EPGL@version ]
\RequirePackage{calc}
\RequirePackage{expex}
\newif\ifEPGL@examplesloaded
\@ifpackageloaded{linguex}{\PackageError{expex-glossonly}{Please load linguex using the package option!}{Please load linguex using the package option!}}{}
\@ifpackageloaded{gb4e}{\PackageError{expex-glossonly}{Please load gb4e using the package option!}{Please load gb4e using the package option!}}{}
\@ifpackageloaded{covington}{\PackageError{expex-glossonly}{Please load covington using the package option!}{Please load covington using the package option!}}{}
% for now this is a separate macro in case it needs to be changed per package.
\newcommand\EPGL@setglossmargin{\setlength{\leftskip}{\@totalleftmargin}}
\def\EPGL@patchexpexgloss{%
  \let\xe\relax
  \let\pex\relax
\def\gl@wrap@below@begin@a{%
   \bgroup
   \parindent0pt
   \ep@setglstrut
   \ifdim\ling@glwidth=0pt
      \ifling@glbreaking
         \bgroup
       \else
         \vtop\bgroup
            \advance\hsize by -\leftskip
            \advance\hsize by -\rightskip
            %\leftskip=0pt
            \EPGL@setglossmargin % this is the changed line
       \fi
   \else
      \vtop\bgroup
         \hsize=\ling@glwidth
         \leftskip=0pt
   \fi
   \leavevmode
   \bgroup
   \parindent=0pt
   \@glpreamblefalse
   \@glftfalse
   \let\mainlist=\empty
   \let\itemtypelist=\empty
   \let\aboveskiplist=\empty
   \let\strutlist=\empty
   \let\everylist=\empty
   \let\colorlist=\empty
}}
\DeclareKeys[expex-glossonly]
{
gb4e.code = {
	\RequirePackage{gb4e}
	\EPGL@examplesloadedtrue
	\EPGL@patchexpexgloss
	\lingset{belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex,everygla=\eachwordone}
	\PackageInfo{expex-glossonly}{Patching ExPex for use with gb4e}
	\typeout{Patching ExPex for use with gb4e}
  },
gb4e-emulate.code = {
	\RequirePackage{gb4e-emulate}
	\EPGL@examplesloadedtrue
    \EPGL@patchexpexgloss
    \lingset{belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex,everygla=\eachwordone}
    \PackageInfo{expex-glossonly}{Patching ExPex for use with gb4e}
    \typeout{Patching ExPex for use with gb4e}
},
linguex.code = {
	\RequirePackage{linguex}
	\EPGL@examplesloadedtrue
    \EPGL@patchexpexgloss
    \lingset{belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex,everygla=\eachwordone}
    \PackageInfo{expex-glossonly}{Patching ExPex for use with linguex}
    \typeout{Patching ExPex for use with linguex}
},
covington.code = {
	\PassOptionsToPackage{covington}{#1}
	\let\ex\relax
	\RequirePackage{covington}
	\EPGL@examplesloadedtrue
	\EPGL@patchexpexgloss
	\newcommand*{\EPGL@glosslineone}{%
       \@ifundefined{glosslineone@global}{\glosslineone}{\glosslineone@global}}
	\lingset{belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex,everygla=\EPGL@glosslineone}
	\PackageInfo{expex-glossonly}{Patching ExPex for use with covington}
    \typeout{Patching ExPex for use with covington}
}
}
\DeclareUnknownKeyHandler[expex-glossonly]{\PackageError{expex-glossonly}{Please specify which example package you are using as a package option!}{Please specify which example package you are using as a package option!}}

\ProcessKeyOptions[expex-glossonly]
\ifEPGL@examplesloaded\else\PackageWarning{expex-glossonly}{No example package specified! Assuming ExPex}\fi

\endinput