% \iffalse meta-comment
% !TEX program = pdfLaTeX
%
%<*internal>
\iffalse
%</internal>
%<*readme>

The leipzig package provides a set of macros for standard glossing abbreviations, with options to create new ones. They are mnemonic (e.g. \Acc{} for accusative, abbreviated \textsc{acc}). They can be used alone or on top of the glossaries package for easy indexing and glossary printing.

For full indexing capabilities, leipzig should be used in conjunction with the glossaries package. Notes for installation are included in the package documentation.

%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
% Copyright (C) 2013 by Natalie Weber
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) 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.
%
%<*internal>
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<*driver>
\ProvidesFile{leipzig.dtx}%
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1996/10/24]%
%<package>\ProvidesPackage{leipzig}%
%<*package>
    [2013/05/26 v1.0 Leipzig package for linguistic abbreviations]%
%\AtBeginDocument{%
%  \MakeShortVerb{\|}
%  \DeleteShortVerb{"}}
%</package>
%
%<*driver>
\documentclass[12pt]{ltxdoc}%
%\usepackage[bmargin=1.5in]{geometry}%
\usepackage{url}%
%\usepackage[utf8x]{inputenc}%
\usepackage[T1]{fontenc}%
\usepackage{tipa}%
\usepackage{expex}% to typeset examples
%\usepackage[longnamesfirst]{natbib}
%\setcitestyle{authoryear,round,semicolon,aysep={},yysep={,},notesep={:}}%
\bibliographystyle{apa-good}
\usepackage{longtable}%
\usepackage{booktabs}%
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC

\newcommand{\refp}[1]{(\protect\ref{#1})}%
 % glossaries somewhere redefines the tilde
%\catcode`\~=\active %catcode 13
%\def~{\ }
\def\leipzig{\textsf{leipzig}}
\def\glossaries{\textsf{glossaries}}
%\EnableCrossrefs
\DisableCrossrefs
%\OnlyDescription
\CodelineIndex
%\PageIndex
\RecordChanges
\usepackage{hyperref}%
\usepackage{xcolor}
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\hypersetup{
    colorlinks, linkcolor={dark-red},
    citecolor={dark-blue}, urlcolor={medium-blue} }
\usepackage[nomain]{glossaries}[2012/05/21 v3.02 (NLCT)]%
\usepackage{glossary-inline}%
\newglossarystyle{mysuper}{%
\glossarystyle{super}% based on super
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{@{}lp{\glsdescwidth}}}%
    {\end{supertabular}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & \makefirstuc{##3}\glspostdescription{}\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\makefirstuc{##4}\glspostdescription{}\\}%
  \renewcommand*{\glsgroupskip}{}%
}%
\usepackage{leipzig}%
\newleipzig{inc}{inc}{inclusive}%
\newleipzig{vblz}{vb}{verbalizer}%
\newcommand{\Fdui}{{\First}{\Du}.{\Inc}}%
\makeglossaries
\glsdisablehyper
\begin{document}%
  \DocInput{leipzig.dtx}%
\end{document}%
%</driver>
%
% \fi
%
%\CheckSum{0}
%
% \CharacterTable
% {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%  Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%  Digits        \0\1\2\3\4\5\6\7\8\9
%  Exclamation   \!     Double quote  \"     Hash (number) \#
%  Dollar        \$     Percent       \%     Ampersand     \&
%  Acute accent  \'     Left paren    \(     Right paren   \)
%  Asterisk      \*     Plus          \+     Comma         \,
%  Minus         \-     Point         \.     Solidus       \/
%  Colon         \:     Semicolon     \;     Less than     \<
%  Equals        \=     Greater than  \>     Question mark \?
%  Commercial at \@     Left bracket  \[     Backslash     \\
%  Right bracket \]     Circumflex    \^     Underscore    \_
%  Grave accent  \`     Left brace    \{     Vertical bar  \|
%  Right brace   \}     Tilde         \~}
%
%
% \changes{v0.5}{2012/05/26}{First documented version (alpha).}
% \changes{v0.6}{2012/07/30}{Changed A, P, and S macros to |\Aarg{}|, |\Parg{}|, and |\Sarg{}|, at the suggestion of Benct Philip Jonsson.}
% \changes{v1.0}{2013/05/26}{First released version}
%
%\iffalse
% Why does it cause strange errors when [indexfirstonly] glossaries option is used?
%
%<*internal>
%%Suggestions:
%%  Make the preamble declarations simpler.
%%  Make a [nolinks] package option to not link leipzig to glossary (but allow other glossary items in other glossaries to link).
%%  Make (first)leipzigfont package options.
%</internal>
%\fi
%
% \DoNotIndex{\@@getoptionalarg,\@@next,\@bracketcheck,\@currsize,\@firstoftwo}
% \DoNotIndex{\@secondoftwo,\@futurenonspacelet,\@getoptionalarg,\@optionaltemp}
% \DoNotIndex{\@gsingle,\@ifnextchar,\@ifpackageloaded,\@ifundefined,\@ne,\z@}
% \DoNotIndex{\@nexttoken,\@normalsize,\@optionalarg,\@optionalnext,\@gobble,\p@}
% \DoNotIndex{\@selfnt,\@stepone,\@steptwo,\@stepthree,\@stoken,\@undefined,\\}
% \DoNotIndex{\active,\addvspace,\advance,\afterassignment,\baselineskip}
% \DoNotIndex{\baselinestretch,\begingroup\bgroup,\box,\catcode,\copy,\csname}
% \DoNotIndex{\CurrentOption,\DeclareOption,\def,\detokenize,\egroup,\else,\empty}
% \DoNotIndex{\endcsname\endgraf\endgroup,PackageOptions,\eplain,\expandafter}
% \DoNotIndex{\expandonce,\fi,\fill,\finalhyphendemerits,\futurelet,\gdef,\global}
% \DoNotIndex{\gobble,\gobblespaces,\hbox,\hskip,\hspace,\ht,\hyphenpenalty}
% \DoNotIndex{\identity,\ifdim,\ifmmode,\ifnum,\ifx,\ifvoid,\ignorespacesafterend}
% \DoNotIndex{\ignorespaces,\itemindent,\itshape,\labelsep,\labelwidth,\lastbox}
% \DoNotIndex{\leavevmode,\leftskip,\let,\lineskip,\llap,\long,\MessageBreak}
% \DoNotIndex{\more,\name,\NAMEskip,\NAMEstyle,\newbox,\newcount,\newenvironment}
% \DoNotIndex{\newif,\newskip,\nobreak,\noexpand,\nolinebreak,\normalsize,\rm}
% \DoNotIndex{\PackageError,\PackageWarning,\par,\parfillskip,\parindent,\rlap}
% \DoNotIndex{\ProcessOptions,\providecommand,\quad,\raggedright,\relax,\rmfamily}
% \DoNotIndex{\rightskip,\scantokens,\scshape,\selectfont,\setbox,\sim,\space}
% \DoNotIndex{\strut,\textup,\the,\tlist@if@empty@nTF,\tolerance,\unhbox,\unskip}
% \DoNotIndex{\unvbox,\upshape,\vbox,\vskip,\vtop,\wd,\z@,\z@skip,\endgraf} 
% \DoNotIndex{} 
% \DoNotIndex{} 
% \DoNotIndex{} 
%
% \GetFileInfo{leipzig.sty}
%
%\title{\leipzig{} package documentation\thanks{This document corresponds to \leipzig{}~\fileversion, dated~\filedate.}}
% \author{Natalie Weber\\\texttt{natalie.a.weber@gmail.com}}
% \date{\filedate}
%
% \maketitle
%\begin{abstract}
%\noindent The \leipzig{} package provides a set of macros for standard glossing abbreviations, with options to create new ones. They are mnemonic (e.g.~\verb+\Acc{}+ for accusative, abbreviated \textsc{acc}). They can be used alone or on top of the \glossaries{} package for easy indexing and glossary printing.
%\end{abstract}
%
% \tableofcontents
%
%\renewcommand{\glossarypreamble}{The \leipzig{} and \glossaries{} package were used to automatically index and print the following gloss abbreviations used in this documentation:\space\gdef\glossarypreamble{}}%
%\renewcommand{\glossarypostamble}{\textsc{\textbf{Note}}: the spaces before punctuation items in this list are abnormal and due to a clash with the \textsf{doc} class used to typset package documentation.\gdef\glossarypostamble{}}%
%\section[Introduction]{Introduction\footnote{\printglossary[style=inline,type=\leipzigtype]}}\label{sec:intro}%
%
%The {\leipzig} package pre-defines (in \textsf{leipzig.tex}) many of the most common gloss abbreviations (essentially equivalent to the appendix to the Leipzig Glossing Rules \cite{bic08}). They are pre-defined to save the end-user time, and also to encourage standardization. They are called with macros like \verb+\Nom{}+, \verb+\Acc{}+, and \verb+\Dat{}+, which typeset {\Nom}, {\Acc}, and {\Dat}, respectively. These macros are short, mnemonic, and stand out visually when editing interlinear gloss texts (IGTs) in the source code. Additional macros are provided to define new abbreviations and to set global display parameters which affect all glosses. When used in conjunction with the \glossaries{} package, the abbreviation macros are indexed in a glossary. These can then be printed in a list, table, or inline glossary; an example of the latter is in a footnote on this page.
%
%\section{Installation and declaration}\label{sec:install}%
%
%\subsection{Basic package}
%
%Download the \leipzig{} package from CTAN and save it somewhere where \LaTeX{} can find it (usually in \$TEXMF/tex/latex/leipzig/). To use the {\leipzig} package, declare it in the preamble of your document:
%
%\ex\verb+\documentclass{article}+\linebreak
% \ldots\linebreak
% \verb+\usepackage{leipzig}+\xe
%
%\vspace{-1ex}
%\subsection{With \glossaries{}}
%
%If you want to use \leipzig{} with indexing capabilities, then you will also need to download the \glossaries{} package, v3.02 (2012/05/21) or later. Version 3.02 comes bundled with the \textsf{glossary-inline} package, which is necessary to make a list of abbreviations in a footnote, as is common in linguistics articles. Save it somewhere \LaTeX{} can find it. Run \texttt{latex glossaries.ins} to generate the style files, if need be, and refer to the installation instructions in the \glossaries{} package.
%
%The \glossaries{} package requires v2.5f (2006/11/18) or later of the \textsf{xkeyval} package. This may be a newer version than the version which came bundled with your distribution, so you should download the newest version of \textsf{xkeyval} from CTAN too. 
%
%Once you have both packages installed, you can use the minimal example file \texttt{minimalgls.tex} to test that \glossaries{} is functioning correctly. See chapter~1 of the \glossaries{} package for more information.
%
%\begin{verbatim}(pdf)latex minimalgls
%makeglossaries minimalgls
%(pdf)latex minimalgls
%(pdf)latex minimalgls\end{verbatim}
%
%The \leipzig{} package should be loaded after \glossaries{}. The \glossaries{} package comes pre-loaded with many glossary styles, but the inline style must be loaded as a separate package.
%
%\ex\verb+\documentclass{article}+\linebreak
%\ldots\linebreak
%\verb+\usepackage{glossaries}+\linebreak
%\verb+\usepackage{glossary-inline}+\linebreak
%\verb+\usepackage{leipzig}+\linebreak
%\verb+\makeglossaries+\linebreak\xe
%The \glossaries{} package is fairly heavyweight, so some useful package options include the following (see section~2.1 of the \glossaries{} user documentation for other package options):
%
%\ex\verb+\usepackage[nomain,nostyles]{glossaries}+\xe
%
%\vspace{-1ex}
%\begin{itemize}
%\item \textbf{nomain} - suppresses creation of a main glossary (useful if you are not using a main glossary and are only using the \glossaries{} package to index abbreviations.)
%\item \textbf{nostyles} - prevents the predefined glossary styles from being loaded. If you use this package option then you must load any style you want to use manually with \verb+\usepackage{+\meta{glossary-style}\verb+}+. The |glossary-inline| style is not automatically loaded by \glossaries{} and must be loaded manually in any case.
%\iffalse
%\item \textbf{indexonlyfirst} - if you have many IGTs in your paper, then you will be using a lot of abbreviations. This option causes only the first usage to be indexed.
%\fi
%\end{itemize}
%
%
%\subsection{With \textsf{hyperref}}
%
%Note that if you have also loaded the \textsf{hyperref} package, then \glossaries{} must be loaded \emph{after} \textsf{hyperref}, contrary to common usage. When \textsf{hyperref} is loaded, each usage of an abbreviation will link to the corresponding glossary entry. If you are using an inline glossary, these hyperlinks will not be very interesting, since they all link to the same page. You can turn them off with the \glossaries{} command |\glsdisablehyper| (but note this will suppress hyperlinks for \emph{all} acronyms and glossary entries, if you have more than one glossary). A minimal preamble declaration would then look like this:
%
%\ex\verb+\documentclass{article}+\linebreak
%\ldots\linebreak
%\verb+\usepackage{hyperref}+\linebreak
%\verb+\usepackage{glossaries}+\linebreak
%\verb+\usepackage{glossary-inline}+\linebreak
%\verb+\usepackage{leipzig}+\linebreak
%\verb+\makeglossaries+\linebreak
%\verb+\glsdisablehyper+\linebreak\xe
%
%\vspace{-2ex}
%
%\section{Package options}\label{sec:options}%
%
%\begin{description}
%\item[glossaries] Using glossary indexing capabilities. Defaults to true when \leipzig{} is loaded after \glossaries{}.
%\item[noglossaries] Turns off glossary indexing capabilities, even when \leipzig{} is loaded after \glossaries{}.
%\item[nostandards] Use this option if you do not want \leipzig{} to print the set of glosses defined in the Leipzig Glossing Rules. Instead it will only print non-standard ones that you define in the preamble with |\newleipzig|.
%\end{description}
%
%\section{Usage}\label{sec:basic}%
%
%\subsection{Abbreviation macros}
%
%The abbreviation macros are usually equivalent to the abbrevation itself, so that \verb+\Cop{}+ will typeset \Cop{}, and \verb+\Ins{}+ will typeset \Ins{}, etc. Note that the macros all begin with an uppercase letter. This makes them easier to see in your .tex file, and uppercase macros are less likely to be defined than lowercase ones. These abbreviation macros take no arguments and will gobble a following space, so they require braces. You can type either \verb+\Cop{}+ or \verb+{\Cop}+.
%
%There are a few notable exceptions, where the macro is not equivalent to the abbreviation, because the expected macro was already defined in \LaTeX{}. These are shown in Table~\refp{unexpected}. Additionally, since macro names cannot start with a number, |\First{}| is the abbreviation macro for \First{}, |\Second{}| is the abbreviation macro for \Second{}, and |\Third{}| is the abbreviation macro for \Third{}.
%
%
%\begin{table}[htbp]\centering
%\begin{tabular}[t]{lll}\toprule
% Command & Short & Long\\\midrule
% \verb+\Aarg{}+ & \sc a & agent\\%\iffalse v0.6\fi
% \verb+\Parg{}+ & \sc p & patient\\ %\iffalse v0.6\fi
% \verb+\Sarg{}+ & \sc s & argument of intransitive verb\\ %\iffalse v0.6\fi
% \verb+\First{}+ & \sc 1 & first person\\
% \verb+\Second{}+ & \sc 2 & second person\\
% \verb+\Third{}+ & \sc 3 & third person\\\bottomrule
% \end{tabular}
% \caption{Unexpected macro names}\label{unexpected}%
%\end{table}
%
%The package also defines macros for common person-number combinations, like \Fsg{} and \Tpl{}. Abbreviations for first person begin with `F' (not `1'), abbreviations for second person begin with `S' (not `2'), and abbreviations for third person begin with `T' (not `3'). These abbreviations are shown in Table~\refp{persons}.
%
%\begin{table}[htbp]\centering
%\begin{tabular}[t]{ll@{\qquad}ll@{\qquad}ll}\toprule
% \verb+\Fsg{}+ & \sc 1sg & \verb+\Ssg{}+ & \sc 2sg & \verb+\Tsg{}+ & \sc 3sg\\
% \verb+\Fdu{}+ & \sc 1du & \verb+\Sdu{}+ & \sc 2du & \verb+\Tdu{}+ & \sc 3du\\
% \verb+\Fpl{}+ & \sc 1pl & \verb+\Spl{}+ & \sc 2pl & \verb+\Tpl{}+ & \sc 3pl\\
% \bottomrule\end{tabular}
% \caption{Abbreviations for persons and number}\label{persons}%
%\end{table}
%
%\subsection{Create new abbreviations}
%
%\DescribeMacro{\newleipzig}%
%Create new abbreviations with the \verb+\newleipzig+ command, which requires three arguments. 
%
%\ex \verb+\newleipzig+ \oarg{options} \marg{macro} \marg{short} \marg{long}\xe
%
% The optional argument \meta{options} is a key=value list which is passed to \glossaries{} if it is loaded. A list of recognized keys is in chapter~4 of the \glossaries{} documentation. 
%
%The first argument \meta{macro} should be the macro name with no backslash in front. The package will capitalize the first letter of \meta{macro} and use the result as the macroname. The second argument \meta{short} is the short abbreviation. This needs to be lowercase so that \texttt{\textbackslash textsc\{\}} will work. (You cannot make capital letters into smallcaps with \texttt{\textbackslash textsc\{\}}.) The third argument \meta{long} is the long version of the acronym. I also recommend typing this argument in lowercase, and using the \glossaries{} package to format the glossary such that all long forms are consistently uppercase or lowercase. This code:
%
%\ex \verb+\newleipzig{vblz}{vb}{verbalizer}+\xe
%\noindent creates a macro \verb+\Vblz{}+ which will typeset \Vblz{} when used.
%
%\paragraph{Fusional gloss abbreviations}
%
%For gloss abbreviations that are fusional, or combinations of several different grammatical glosses, you should use |\newleipzig| for each individual part. As an example, \Fdui{} is a combination of abbreviations for first person, dual number, and inclusivity. Abbreviations for first person (|\First{}|) and dual number (|\Du{}|) are already defined in \texttt{leipzig.tex}, so \Inc{} is the only part which still needs to be defined. It is generally useful to then create a shortcut macro (with |\newcommand|) for the fusional gloss which will call the abbreviations of the various parts. I usually use a command name that mirrors the abbreviations by beginning with a capital letter. 
%
%\ex|\newleipzig{inc}{inc}{inclusive}|\newline
%|\newcommand{\Fdui}{{\Fdu}.{\Inc}}%|\newline
%\ldots the |\Fdui{}| morpheme\ldots |%| Prints \Fdui{}.\xe
%
%This is actually how the person-number combinations like |\Tpl{}| are defined in \leipzig{}. The reason is so that the glossary will contain the individual components (\First{} = first person, \Sg{} = singular) instead of all of the various combinations thereof. 
%
%\subsection{Redefine existing abbreviations}
%
%
%\subsection{Display parameters}\label{intext}%
%
%\iffalse
%\paragraph{Font display}
%\DescribeMacro{\leipzigfont}
%\DescribeMacro{\firstleipzigfont}
%By default, abbreviations are printed in smallcaps. You can control the style of how abbreviations are printed on first use or on subsequent uses with |\firstleipzigfont|\footnote{This macro only has an effect when \glossaries{} is loaded.} and |\leipzigfont|. However, these must be defined \emph{before} any |\newleipzig| commands that should conform to this style. The style for a certain abbreviation is set when the glossary entry is defined. In practice this means that you cannot change styles partway through a paper, and that you should declare |\firstleipzigfont| and |\leipzigfont| before you load \texttt{leipzig.tex} (or declare any other abbreviations). The following preamble declaration makes the first use of each abbreviation bold.
%
%\begin{verbatim}\usepackage{glossaries}
%\usepackage{glossary-inline}
%\glossarystyle{inline}
%\usepackage{leipzig}
%\renewcommand{\firstleipzigfont}[1]{\textsc{\textbf{#1}}}
%\loadglsentries{leipzig}% or \input{leipzig.tex}
%\makeglossaries\end{verbatim}
%\fi
%
%\paragraph{Gloss display}
%The command |\newleipzig| not only creates a new definition entry, but also creates a mnemonic macro like |\Vblz{}|, which simply expands to |\gls{vblz}|. You can still access the short, long, or full forms of the abbreviation without affecting the first use flag using macros like |\acrshort|, |\Acrlong|, or |\ACRfull| (see chapter~13 of the \glossaries{} documentation for a list). A few examples are shown in table~\refp{acrabbrv}.
%
%\begin{table}[htbp]
%  \centering
%  \begin{tabular}[t]{ll}\toprule
%Command & Prints\\
%|\acrshort{vblz}| & \acrshort{vblz}\\
%|\Acrshort{vblz}| & \Acrshort{vblz}\\
%|\ACRshort{vblz}| & \ACRshort{vblz}\\
%|\acrlong{vblz}| & \acrlong{vblz}\\
%|\Acrlong{vblz}| & \Acrlong{vblz}\\
%|\ACRlong{vblz}| & \ACRlong{vblz}\\
%|\acrfull{vblz}| & \acrfull{vblz}\\
%|\Acrfull{vblz}| & \Acrfull{vblz}\\
%|\ACRfull{vblz}| & \ACRfull{vblz}\\
%  \bottomrule\end{tabular}
%  \caption{Short, long, and full formats}
%  \label{acrabbrv}
%\end{table}
%
%\DescribeMacro{\acrfullformat}
%The format of |\acrfull| defaults to \textit{long-form} (\textit{short}). You can change this by redefining |\acrfullformat| in your preamble (argument \#1 is the long form and argument \#2 is the short form):
%
%\ex\verb+\renewcommand{\acrfullformat}[2]{#2\space(#1)}+\xe
%
%\renewcommand{\acrfullformat}[2]{#2\space(#1)}\noindent changes the order so that |\acrfull{vblz}| prints: \acrfull{vblz}.\renewcommand{\acrfullformat}[2]{#1\space(#2)}%
%
%\section{Printing the glossary}\label{printglossary}%
%
%\leipzig{} piggybacks on the \glossaries{} package, which allows multiple glossaries and lists of abbreviations with indexing capabilities. The command |\newleipzig| secretly calls |\newacronym| of the \glossaries{} package and loads the acronym into the glossary type called by |\leipzigtype| (which defaults to \texttt{leipzig}, a glossary which is pre-defined by \leipzig{}).
%
%\subsection{Inline glossaries}
%\DescribeMacro{\printglossary}
%Print the glossary using |\printglossary| anywhere in the document, but usually in the first footnote. You must specify the glossary style and type: 
%
%\ex|\footnote{\printglossary[style=inline,type=\leipzigtype]}|\xe
%
%To build the glossary, you need to \LaTeX{} the document once, so that \glossaries{} can index all abbreviations used and write them to an external file. Then run |makeglossaries| to build the glossary, and \LaTeX{} twice more to print it and format it. See chapter~1 of the \glossaries{} documentation for more information.
%
%\begin{verbatim}(pdf)latex myfile.tex
%makeglossaries myfile
%(pdf)latex myfile.tex
%(pdf)latex myfile.tex\end{verbatim}
%
%\DescribeMacro{\glsinlineshortlongseparator}
%\DescribeMacro{\glsinlineseparator}
%\DescribeMacro{\glspostinline}
%\indent See the glossary in the footnote on the first page of this documentation for the default settings of the glossary. Short and long forms of abbreviations are separated by an equals sign, glossary entries are separated by a comma, and the glossary ends in a period. You can change them by using renewcommand sometime before |\printglossaries|:
%
%\ex|\renewcommand{\glsinlineseparator}{,\space}|\newline
%|\renewcommand{\glsinlineshortlongseparator}{$\sim$}|\newline
%|\renewcommand{\glspostinline}{}|\xe%
%\renewcommand{\glsinlineseparator}{,\space}%
%\renewcommand{\glsinlineshortlongseparator}{$\sim$}%
%\renewcommand{\glspostinline}{}%
%Please note that the command |\glsinlineshortlongseparator| is not defined in the \glossaries{} package, but only by the \leipzig{} package. If the |glossary-inline| style is loaded, then \leipzig{} redefines |theglossary| environment, where the glossary is printed, to include this functionality.
%
%\DescribeMacro{\glsnamefont}
%The abbreviations within the glossary are formatted with |\glsnamefont|; \leipzig{} uses smallcaps by default.
%
%\ex|\renewcommand{\glsnamefont}[1]{\textbf{#1}}%|\xe
%\renewcommand{\glsnamefont}[1]{\textbf{#1}}%
%\renewcommand*{\glsgroupheading}[1]{}%
%\renewcommand*{\glsgroupskip}{}%
%
%\DescribeMacro{\leipzigname}
%\DescribeMacro{\glossarysection}
%The name of the gloss abbreviations glossary defaults to `Abbreviations' and is printed as the first argument in |\glossarysection|, which defaults to print nothing in \leipzig{}. The name is controlled by |\leipzigname|, so to change the name you can redefine |\leipzigname|:
%
%\ex|\renewcommand{\leipzigname}{My new glossary header}|\linebreak
%|\renewcommand*{\glossarysection}[2][]{\textit{#1}:\space}%|\xe%
%\renewcommand{\leipzigname}{My new glossary header}
%\renewcommand*{\glossarysection}[2][]{\textit{#1}:\space}%
%Then I will re-print the glossary in this footnote\footnote{\printglossary[type=\leipzigtype,style=inline] does not end in a period, to illustrate a change from the default}, using the parameters redefined above. Compare this glossary to that on the first page to see the differences.
%
%Here is the code I used to print that footnote:
%
%\ex\texttt{...in this footnote\textbackslash footnote\{\textbackslash printglossary[type=\textbackslash leipzigtype, style=inline]does not end in a period, to illustrate a change from the default\}, using the...}\xe
%
%\subsection{Block glossaries}
%
%\renewcommand{\leipzigname}{Abbreviations}
%\renewcommand{\glossarypreamble}{}
%\renewcommand{\glsnamefont}[1]{\textsc{\bfseries #1}}
%\renewcommand*{\glossarysection}[2][]{\section{#1}}
%\renewcommand{\glspostdescription}{}
%
%If you are writing a book or lengthy manuscript, you probably want the glossary to be printed on a separate page in the frontmatter. The \glossaries{} package comes pre-packaged with several different glossary styles, based on tabular environments, list environments, and more. You can also custom-build a glossary style. Below is one which I have been using. The code is in section~\refp{sec:custglos}.
%
%\fbox{\begin{minipage}[t]{4in}
%\printglossary[style=mysuper,type=\leipzigtype]
%\end{minipage}}
%
%\section{Multiple lists of acronyms}
%
%What do you do if your paper needs not only a list of gloss abbreviations, but also some other list(s) of acronyms, possibly formatted differently than the gloss abbreviations? All abbreviations declared with |\newleipzig| are saved in the |leipzig| glossary. This means that you can still use the |acronym| function in the \glossaries{} package for other acronyms (or define your own glossary). Use the |acronym| package option:
%
%\ex|\usepackage[acronym]{glossaries}|\xe
%
%\noindent and declare new acronyms with |\newacronym|:
%
%\ex|\newacronym|\oarg{options}\marg{unique-id}\marg{short}\marg{long}\xe
%
%\noindent and refer to chapter~13 in the \glossaries{} user documentation for more information about how to create acronym lists. 
%
%The \leipzig{} package defines a newglossary called |leipzig|:
%
%\ex|\newglossary{leipzig}{lzs}{lzo}{\leipzigname}|\xe
%
%Gloss abbreviations defined with |\newleipzig| are added to glossary type |\leipzigtype|, which defaults to |leipzig|. (This is so that if you have other lists of acronyms in your paper, they will not be formatted the same as the gloss abbreviations.) You can redefine |\leipzigtype| to some other glossary if you want abbreviations to be added to some other glossary of your choice. The following line of code will instead put all gloss abbreviations into |\acronymtype|, which is a macro defined by the \glossaries{} package. If the |acronym| package option was declared, then |\acronymtype| points to the |acronym| glossary (pre-defined in \glossaries{}); if not, then |\acronymtype| points to the |main| glossary (also pre-defined by \glossaries{}).
%
%\ex|\renewcommand{\leipzigtype}{\acronymtype}|\xe
%
%\section{Known bugs}
%
%Using \leipzig{} for glossing abbreviations alongside other glossaries and/or lists of acronyms is largely untested but probably has unexpected results. Please contact me with issues.
%
% \begin{thebibliography}{9}
% \bibitem{bic08} Bickel, Balthasar, Bernard Comrie, and Martin Haspelmath. (2008). ``The Leipzig Glossing Rules. Conventions for Interlinear Morpheme by Morpheme Glosses.'' Revised version of February 2008. Department of Linguistics, Max Plank Institute for Evolutionary Anthropology. Retreived 30 June 2012: \url{http://www.eva.mpg.de/lingua/resources/glossing-rules.php}.
% \end{thebibliography}
%\clearpage
%\appendix
%\section{Pre-defined abbreviations}\label{abbrvlist}%
% \begin{longtable}{lll}\toprule
% Command & Short & Long\\\midrule
% \verb+\First{}+ & \sc 1 & first person\\
% \verb+\Second{}+ & \sc 2 & second person\\
% \verb+\Third{}+ & \sc 3 & third person\\
% \verb+\Abl{}+ & \sc abl & ablative\\
% \verb+\Abs{}+ & \sc abs & absolutive\\
% \verb+\Acc{}+ & \sc acc & accusative\\
% \verb+\Adj{}+ & \sc adj & adjective\\
% \verb+\Adv{}+ & \sc adv & adverbial\\
% \verb+\Aarg{}+ & \sc a & agent\\
% \verb+\Agr{}+ & \sc agr & agreement\\
% \verb+\All{}+ & \sc all & allative\\
% \verb+\Antip{}+ & \sc antip & antipassive\\
% \verb+\Appl{}+ & \sc appl & applicative\\
% \verb+\Art{}+ & \sc art & article\\
% \verb+\Aux{}+ & \sc aux & auxiliary\\
% \verb+\Ben{}+ & \sc ben & benefactive\\
% \verb+\Caus{}+ & \sc caus & causative\\
% \verb+\Clf{}+ & \sc clf & classifier\\
% \verb+\Com{}+ & \sc com & comitative\\
% \verb+\Comp{}+ & \sc comp & complementizer\\
% \verb+\Compl{}+ & \sc compl & completive\\
% \verb+\Cond{}+ & \sc cond & conditional\\
% \verb+\Cop{}+ & \sc cop & copula\\
% \verb+\Cvb{}+ & \sc cvb & converb\\
% \verb+\Dat{}+ & \sc dat & dative\\
% \verb+\Decl{}+ & \sc decl & declarative\\
% \verb+\Defn{}+ & \sc def & definite\\
% \verb+\Dem{}+ & \sc dem & demonstrative\\
% \verb+\Det{}+ & \sc det & determiner\\
% \verb+\Dist{}+ & \sc dist & distal\\
% \verb+\Distr{}+ & \sc distr & distributive\\
% \verb+\Du{}+ & \sc du & dual\\
% \verb+\Dur{}+ & \sc dur & durative\\
% \verb+\Erg{}+ & \sc erg & ergative\\
% \verb+\Excl{}+ & \sc excl & exclusive\\
% \verb+\F{}+ & \sc f & feminine\\
% \verb+\Foc{}+ & \sc foc & focus\\
% \verb+\Fut{}+ & \sc fut & future\\
% \verb+\Gen{}+ & \sc gen & genitive\\
% \verb+\Imp{}+ & \sc imp & imperative\\
% \verb+\Incl{}+ & \sc incl & inclusive\\
% \verb+\Ind{}+ & \sc ind & indicative\\
% \verb+\Indf{}+ & \sc indf & indefinite\\
% \verb+\Inf{}+ & \sc inf & infinitive\\
% \verb+\Ins{}+ & \sc ins & instrumental\\
% \verb+\Intr{}+ & \sc intr & intransitive\\
% \verb+\Impf{}+ & \sc impf & imperfective\\
% \verb+\Irr{}+ & \sc irr & irrealis\\
% \verb+\Loc{}+ & \sc loc & locative\\
% \verb+\M{}+ & \sc m & masculine\\
% \verb+\N{}+ & \sc n & neuter\\
% \verb+\Neg{}+ & \sc neg & negative\\
% \verb+\Nmlz{}+ & \sc nmlz & nominalizer\\   
% \verb+\Nom{}+ & \sc nom & nominative\\      
% \verb+\Obj{}+ & \sc obj & object\\          
% \verb+\Obl{}+ & \sc obl & oblique\\         
% \verb+\Pass{}+ & \sc pass & passive\\       
% \verb+\Parg{}+ & \sc p & patient\\           
% \verb+\Pfv{}+ & \sc pfv & perfective\\      
% \verb+\Pl{}+ & \sc pl & plural\\            
% \verb+\Poss{}+ & \sc poss & possessive\\    
% \verb+\Pred{}+ & \sc pred & predicative\\   
% \verb+\Prf{}+ & \sc prf & perfect\\         
% \verb+\Prs{}+ & \sc prs & present\\         
% \verb+\Prog{}+ & \sc prog & progressive\\   
% \verb+\Proh{}+ & \sc proh & prohibitive\\   
% \verb+\Prox{}+ & \sc prox & proximal\\      
% \verb+\Pst{}+ & \sc pst & past\\            
% \verb+\Ptcp{}+ & \sc ptcp & participle\\    
% \verb+\Purp{}+ & \sc purp & purposive\\     
% \verb+\Q{}+ & \sc q & question particle\\   
% \verb+\Quot{}+ & \sc quot & quotative\\     
% \verb+\Recp{}+ & \sc recp & reciprocal\\    
% \verb+\Refl{}+ & \sc refl & reflexive\\     
% \verb+\Rel{}+ & \sc rel & relative\\        
% \verb+\Res{}+ & \sc res & resultative\\     
% \verb+\Sbj{}+ & \sc sbj & subject\\         
% \verb+\Subj{}+ & \sc subj & subjunctive\\   
% \verb+\Sg{}+ & \sc sg & singular\\          
% \verb+\Sarg{}+ & \sc s & argument of intransitive argument\\  
% \verb+\Top{}+ & \sc top & topic\\           
% \verb+\Tr{}+ & \sc tr & transitive\\        
% \verb+\Voc{}+ & \sc voc & vocative\\\bottomrule   
% \end{longtable}
% 
%\section{Custom glossary environment}\label{sec:custglos}%
%\begin{verbatim}\documentclass{book}
%
% \usepackage[nomain,section=chapter]{glossaries}%
%    [2012/05/21 v3.02 (NLCT)]%
% \usepackage{glossary-inline}%
% \newglossarystyle{mysuper}{%
% \glossarystyle{super}% based on super
%   \renewenvironment{theglossary}%
%     {\tablehead{}\tabletail{}%
%      \begin{supertabular}{@{}lp{\glsdescwidth}}}%
%     {\end{supertabular}}%
%   \renewcommand*{\glossaryheader}{}%
%   \renewcommand*{\glsgroupheading}[1]{}%
%   \renewcommand*{\glossaryentryfield}[5]{%
%     \glsentryitem{##1}\glstarget{##1}{##2} 
%       & \makefirstuc{##3}\glspostdescription{}\\}%
%   \renewcommand*{\glossarysubentryfield}[6]{%
%      &
%      \glssubentryitem{##2}%
%      \glstarget{##2}{\strut}\makefirstuc{##4}\glspostdescription{}\\}%
%   \renewcommand*{\glsgroupskip}{}%
% }%
% \usepackage{leipzig}%
% \makeglossaries
% \glsdisablehyper
%
%\begin{document}
%\printglossary[style=mysuper,type=\leipzigtype]
%\end{document}\end{verbatim}
%
% \StopEventually{}
%\section{The Code}
% \iffalse
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \fi
% \iffalse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  This is a simple list of newcommands which create shortcuts for   %%
%%  standard linguistic glosses (see the Leipzig Glossing rules,      %%
%%  http://www.eva.mpg.de/lingua/resources/glossing-rules.php         %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \fi
%This code originally Sven Siegmund's, created with help of XeTeX mailing list, to detect optional argument. See \url{http://xelatex.blogspot.com/2008/03/newcommand-with-optional-argument.html}.
%    \begin{macrocode}
\long\def\tlist@if@empty@nTF #1{%
  \expandafter\ifx\expandafter\\\detokenize{#1}\\%
  \expandafter\@firstoftwo%
  \else%
  \expandafter\@secondoftwo%
  \fi%
}%
%    \end{macrocode}
%Some booleans to determine whether the \glossaries{} package is loaded or not. The idea was to be able to let users load the \leipzig{} class either before or after \glossaries{}, but they do not currently work well.
%    \begin{macrocode}
\newif\ifleipzig@glossaries\leipzig@glossariesfalse
\newif\ifleipzig@noglossaries\leipzig@noglossariesfalse
%    \end{macrocode}
%A boolean to not index the abbreviations defined in the Leipzig Glossing Rules.
%    \begin{macrocode}
\newif\ifleipzig@donotindex\leipzig@donotindexfalse
%    \end{macrocode}
%\begin{macro}{glossaries}
%\begin{macro}{noglossaries}
%Users can specify with package options whether they would like to use \leipzig{} with the indexing capabilities of \glossaries{}. For instance, if the \glossaries{} package is loaded but the user does not want to index abbreviations, then he can use the \texttt{noglossaries} package option.
%    \begin{macrocode}
\DeclareOption{glossaries}{\leipzig@glossariestrue}
\DeclareOption{noglossaries}{\leipzig@noglossariestrue}
%\RequirePackage{xkeyval}
%\newlength{\preview@border}
%\setlength{\preview@border}{0pt}
%\DeclareOptionX{PreviewBorder}[0pt]{\setlength{\preview@border}{#1}
%\ProcessOptionsX
%    \end{macrocode}
%\end{macro}
%\end{macro}
%\begin{macro}{nostandards}
%Use this package option if you do not want the standard Leipzig abbreviations to show up in the glossary.
%    \begin{macrocode}
\DeclareOption{nostandards}{\leipzig@donotindextrue}
%    \end{macrocode}
%\end{macro}
%Pass any other options to the \glossaries{} package and process options.
%    \begin{macrocode}
\DeclareOption*{%
  \PassOptionsToPackage{\CurrentOption}{glossaries}%
}%
\ProcessOptions\relax
%    \end{macrocode}
%Determine if the \glossaries{} package was loaded, and set the boolean to true (unless overwritten by the user with the package option \texttt{noglossaries}).
%    \begin{macrocode}
\@ifpackageloaded{glossaries}{% true text
  \ifleipzig@noglossaries\leipzig@glossariesfalse\relax
  \else\leipzig@glossariestrue\relax\fi
}{% false text
  \ifleipzig@glossaries\PackageWarning{leipzig}{%
    glossaries package not loaded. Load glossaries
    package at some point.}%
  \else\leipzig@glossariesfalse\relax\fi
}%
%    \end{macrocode}
%If glossary-inline style not loaded, do nothing. Else renew inline style to have a user-defined separator between the abbreviation and long form. 
%    \begin{macrocode}
\@ifpackageloaded{glossary-inline}{% renew inline
\renewglossarystyle{inline}{%
  \renewenvironment{theglossary}%
    {%
      \def\gls@inlinesep{}%
      \def\gls@inlinesubsep{}%
      \def\gls@inlineshortlongsep{%
          \glsinlineshortlongseparator}% added this
    }%
    {\glspostinline}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \gls@inlinesep
    \glsentryitem{##1}\glstarget{##1}{##2}%
    \def\glo@desc{##3}%
    \def\@no@post@desc{\nopostdesc}%
    \ifx\glo@desc\@no@post@desc
    \else
      \ifstrempty{##3}{}{\gls@inlineshortlongsep##3}%
    \fi
    \ifglshaschildren{##1}%
    {%
       \glsresetsubentrycounter
       \glsinlineparentchildseparator
       \def\gls@inlinesubsep{}%
    }%
    {}%
    \def\gls@inlinesep{\glsinlineseparator}%
  }%
  \renewcommand*{\glossarysubentryfield}[6]{%
    \gls@inlinesubsep%
    \glstarget{##2}{}%
    \glssubentryitem{##2}##4%
    \def\gls@inlinesubsep{\glsinlinesubseparator}%
  }%
  \renewcommand*{\glsgroupskip}{}%
}
%    \end{macrocode}
%\begin{macro}{glsinlineshortlongseparator}
%\begin{macro}{glsnamefont}
%\begin{macro}{glossarysection}
%The separator between the short and long forms in the glossary can  be set to a user-defined style like \{=\} or \verb+{:\space}+ (default is \verb+\space+). By default the short form of the abbreviations are set to smallcaps, and there is no glossary section title.
%    \begin{macrocode}
\newcommand*{\glsinlineshortlongseparator}{\,=\,\linebreak[1]}% added this
\renewcommand*{\glsinlineseparator}{,\space}% changed from ;\space
\renewcommand*{\glsinlinesubseparator}{,\space}
\renewcommand*{\glsinlineparentchildseparator}{:\space}
\renewcommand*{\glspostinline}{.\space}% changed from .
\renewcommand{\glsnamefont}[1]{\textsc{#1}}% abbrv in glossary are \sc
\renewcommand*{\glossarysection}[2][]{}% no section name
}{\relax}% if glossary-inline not loaded
%    \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%    \begin{macrocode}
% Default is to print all grammatical glosses in small caps:
\newcommand{\leipzigfont}[1]{\textsc{#1}}% 
\newcommand{\firstleipzigfont}[1]{\leipzigfont{#1}}%
\ifleipzig@glossaries %if glossaries package loaded
  \renewcommand*{\acrpluralsuffix}{\textup{\glspluralsuffix}}%
  \newcommand{\leipzigname}{Abbreviations}
  \newglossary{leipzig}{lzs}{lzo}{\leipzigname}
  \newcommand{\leipzigtype}{leipzig}
%% The following commands are based on the Custom Acronym commands in the glossaries package. 
% %% #1 = first / firstplural / text / plural (as appropriate
% %% #2 = description
% %% #3 = symbol
% %% #4 = inserted text
\newcommand*{\SetLeipzigDisplayStyle}[1]{%
  \defglsdisplay[#1]{\leipzigfont{##1}##4}%
  \defglsdisplayfirst[#1]{\firstleipzigfont{##1}##4}%
}
\newcommand*{\CustomLeipzigFields}{%
  name={\the\glsshorttok},%
  description={\the\glslongtok},%
  symbol={\the\glsshorttok},%
  first={\firstleipzigfont{\the\glsshorttok}},%
  firstplural={\firstleipzigfont{\the\glsshorttok}\noexpand\acrpluralsuffix},%
  text={\leipzigfont{\the\glsshorttok}},%
  plural={\leipzigfont{\the\glsshorttok}\noexpand\acrpluralsuffix}%
}
\newcommand*{\LeipzigAcronymDef}{%
  \protected@edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\leipzigtype,%
      short={\leipzigfont{\the\glsshorttok}},% used in e.g. \acrshort
      shortplural={\leipzigfont{\the\glsshorttok}\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      user1={\the\glsshorttok},%
      user2={\the\glsshorttok\noexpand\acrpluralsuffix},%
      user3={\the\glslongtok},%
      user4={\the\glslongtok\noexpand\acrpluralsuffix},%
      \CustomLeipzigFields,%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
\newcommand*{\SetLeipzigStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\leipzigtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetLeipzigDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \LeipzigAcronymDef
  }%
%%  \@for\@gls@type:=\@glsacronymlists\do{% sets style for all acronymlists?
%%%%    \SetCustomDisplayStyle{\@gls@type}%
%%    \SetLeipzigDisplayStyle{\@gls@type}%
%%  }%
}% 
\SetLeipzigStyle
%%Normally would have |\leipzigfont{#2}|, but I coded the leipzigfont directly into the short form. How else to do it?
\renewcommand{\acrfullformat}[2]{#1\space(#2)}
\newcommand{\newleipzig}[4][]{%
  \bgroup
    \tlist@if@empty@nTF{#1}%
      {\newacronym[type=\leipzigtype]{#2}{#3}{#4}}%
      {\newacronym[type=\leipzigtype,#1]{#2}{#3}{#4}}%
 %   \newacronym[type=\leipzigtype][#1]{n#2}{n#3}{Non-#4}
    \@newleipzig(#3)#2\@nil}%
  \def\@newleipzig(#1)#2#3\@nil{%
%    \end{macrocode}
% If the |leipzig@donotindex| boolean is toggled, then |\gls| will not be called whenever the macro abbreviation is called. That way, these abbreviations are never indexed and won't show up in the glossary, but they will be formatted just like other abbreviations.
%    \begin{macrocode}
      \ifleipzig@donotindex
        \uppercase{\expandafter\gdef\csname #2}#3\endcsname{\leipzigfont{#1}}
%    \end{macrocode}
%Otherwise, |\gls| is called, and any time the macro abbreviation is used, this acronym will be indexed and appear in the glossary.
%    \begin{macrocode}
      \else
        \uppercase{\expandafter\gdef\csname #2}#3\endcsname{\gls{#2#3}}
      \fi  
      \egroup
    }% end if glossaries loaded
%    \end{macrocode}
%If \glossaries{} not loaded, then the code is much shorter:
%    \begin{macrocode}
\else % if glossaries not loaded
  \newcommand{\newleipzig}[4][]{\@newleipzig(#3)#2\@nil}%
  \def\@newleipzig(#1)#2#3\@nil{%
    \uppercase{\expandafter\gdef\csname #2}#3\endcsname{\leipzigfont{#1}}
  }%
\fi
%    \end{macrocode}
%Finally, load the standard gloss abbreviations.
%    \begin{macrocode}
\input{leipzig.tex}
\ifleipzig@donotindex\leipzig@donotindexfalse\fi
%    \end{macrocode}
% \iffalse
%    \begin{macrocode}
%</package>
%    \end{macrocode}
% \fi
% \Finale
\endinput