% !TEX TS-program = lualatexmk
\def\EPGLversion{0.9b}
\def\EPGLdate{February 14, 2024}
\documentclass[11pt]{article}
\title{\textbf{The \textsf{expex-glossonly} package}}
\author{\textbf{Alan Munn}\\Department of Linguistics, Languages, and Cultures\\Michigan State University\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}}
\date{Version \EPGLversion\\\EPGLdate}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage{fontspec}
\setmonofont[Scale=MatchLowercase]{DejaVu Sans Mono}
\usepackage{titling}
\usepackage{array, booktabs, multicol, fancyhdr, xspace,tabularx}
\usepackage{enumitem}
\usepackage{fancyvrb,listings,url}
\usepackage[sf,compact]{titlesec}
\usepackage[colorlinks=true]{hyperref}


\DefineShortVerb{\|}
\newcommand*\bs{\textbackslash}

  
\lstset{%
    basicstyle=\ttfamily\small,
    commentstyle=\itshape\ttfamily\small,
    keywordstyle={},
    showspaces=false,
    showstringspaces=false,
    breaklines=true,
    breakautoindent=true,
    breakindent=1em,
    xrightmargin=2.5em,
    captionpos=t,
    frame=tl,
    language=TeX,
}
  
\newcommand*{\pkg}[1]{\texttt{#1}\xspace}
\setitemize[1]{label={}}
\setitemize[2]{label={}}
\setdescription{font={\normalfont}}
\setlength{\droptitle}{-1in}

\lhead{}
\chead{}
\rhead{}
\lfoot{\emph{}}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}


\begin{document}
\maketitle
\thispagestyle{empty}
\renewcommand{\abstractname}{\sffamily Abstract}
\abstract{\noindent\begin{quote}This is an experimental package which is designed to let \pkg{gb4e}, \pkg{linguex} and \pkg{covington} package users use the advanced glossing capabilities of the very powerful ExPex package.\end{quote}}
\section{Introduction}
The ExPex package by John Frampton provides very fine-grained control over glossing and example formatting, including unlimited gloss lines and various ways of formatting multiline glosses.  By contrast the \pkg{cgloss4e} glossing macros provided with both \pkg{gb4e} and \pkg{linguex}, and to some extent, the glossing macros of \pkg{covington} although very capable at basic glossing, lack the degree of customization that is sometimes needed for more complex glossing.

On the other hand, for those users who have heavily invested in using \pkg{gb4e}, \pkg{linguex}, or \pkg{covington}, shifting to ExPex can be quite daunting and burdensome, especially since the basic syntax of the examples is quite different.

This package is an attempt to have the best of both worlds: it allows \pkg{gb4e}, \pkg{linguex}, or \pkg{covington} users to keep using those packages for basic example numbering and formatting, but also allows them to use the glossing macros that ExPex provides.

\section{Package usage}
Usage of the package is simple: simply load it instead of your usual example numbering package, and specify as a package option which numbering package you're using. So for example. Four example numbering packages are currently supported: \pkg{gb4e}, \pkg{linguex}, \pkg{covington}, and \pkg{gb4e-emulate}. The latter is an experimental reimplementation of \pkg{gb4e} using \pkg{enumitem} and is not currently released to CTAN, but available on \href{https://github.com/amunn/gb4e-emulate}{GitHub}.  Package options for loading \pkg{covington} can be given by adding them to the |covington| package option. Since they are an argument of the |covington| key, the set of options must be enclosed in |{...}|.

\begin{table}
\centering
\caption{Package loading options}
\begin{tabular}{l}
\toprule
\begin{lstlisting}[frame=none]
\usepackage[gb4e]{expex-glossonly}
\end{lstlisting}\\
\begin{lstlisting}[frame=none]
\usepackage[linguex]{expex-glossonly}
\end{lstlisting}\\
\begin{lstlisting}[frame=none]
\usepackage[covington={<covington package options>}]{expex-glossonly}
\end{lstlisting}\\
\begin{lstlisting}[frame=none]
\usepackage[gb4e-emulate]{expex-glossonly}
\end{lstlisting}\\
\bottomrule
\end{tabular}
\end{table}

The package checks for which example numbering package you have loaded and then patches the main glossing macro in ExPex to adjust to the horizontal spacing parameters of the particular example package you loaded.

It disables some incompatible commands from ExPex (specifically any commands that would introduce a numbered or lettered example, such as |\ex|, |\pex|, |\xe|) so you should not use them. Since it it is assumed that you will not be using ExPex for numbering, only for glosses, and parts of the ExPex code that deal with example numbering should be assumed not to work.

The package does \emph{not} change the existing glossing macros of the base numbering package. This means that using the package does \emph{not} require you to use ExPex glossing macros for all your glossing. You can continue to use the glossing macros provided by the base numbering package. What this package does is \emph{extend} the capabilities of the base numbering package to allow you to use ExPex glosses as well as the regularly provided glossing facilities of the base package. 
\section{Examples}
Here are some sample documents using the supported packages:

\subsection{\pkg{gb4e}}
\begin{quote}
\begin{lstlisting}
\documentclass{article}
\usepackage[gb4e]{expex-glossonly}
\usepackage{cgloss}
\begin{document}

\begin{exe}
\ex
\begin{xlist}
\ex[*]{ This is a regular example.}
\ex[]{\label{foo}
	\begingl
    \gla\rightcomment{(Hungarian)}János háza//
    \glb John house.his//
    \glft `John's house'//
    \endgl
}
\ex[]{\gll János háza\\
	       John house\\\hfill(Hungarian)
	  \glt `John's house'
	  }
\end{xlist}	  
\end{exe}

\end{document}
\end{lstlisting}
\end{quote}
\clearpage
\subsection{\pkg{linguex}}
\begin{quote}
\begin{lstlisting}
\documentclass{article}

\usepackage[linguex]{expex-glossonly}

\begin{document}

\ex.
\a.
    \begingl
    \gla\rightcomment{(Hungarian)}János háza//
    \glb John house.his//
    \glft `John's house'//
    \endgl
\bg. János háza\\
     John house.his\\
    `John's house'

\end{document}
\end{lstlisting}
\end{quote}

\subsection{\pkg{covington}}

\begin{quote}
\begin{lstlisting}
\documentclass{article}
\usepackage[covington]{expex-glossonly}

\begin{document}

\begin{examples}
\item An example
\item Another example
\end{examples}
\begin{subexamples}
\item
   \begingl
    \gla\rightcomment{(Hungarian)}János háza//
    \glb John house.his//
    \glft `John's house'//
    \endgl
\item \digloss{János háza}[(Hungarian)]
			  {John house.his}
			  {`John's house}
\end{subexamples}
\end{document}
\end{lstlisting}
\end{quote}

\section{Bugs and support}
This is \emph{experimental} and has not been extensively tested. Use at your own risk. You're welcome to raise issues at the \href{https://github.com/amunn/expex-glossonly}{GitHub repository}, however.
\section{Version history}
The initial version of the package (0.6) supported only \pkg{linguex} and \pkg{gb4e}. Version 0.7 changed the loading interface to provide support for \pkg{covington} and added support for \pkg{gb4e-emulate}. Version 0.8  fixed a spacing bug with grammaticality judgements in \pkg{linguex}. Version 0.9 fixed more spacing problems with \pkg{linguex}.
\section{Acknowledgements}
As always, thanks to the members of the LaTeX development team and other users who are always happy to answer questions in the \href{https://tex.stackexchange.com}{TeX.se} chat room. Thanks especially to Ulrike Fischer who told me of the magical |\@totalleftmargin| length.  Thanks also to Jürgen Spitzmüller for discussion of the \pkg{covington} support.
\end{document}