%%
%% This is file `textglos.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% textglos.dtx  (with options: `package')
%% This is a generated file.
%% 
%% ----------------------------------------------------------------
%% textglos --- A package to typeset inline linguistic examples.
%% E-mail: natalie.a.weber@gmail.com
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%% 
%% 
%% Copyright 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.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Natalie Weber.
%% 
%% This work consists of the files textglos.dtx and textglos.ins
%% and the derived files textglos.sty and textglos.pdf.
%% 
\NeedsTeXFormat{LaTeX2e}[1996/10/24]%
\ProvidesPackage{textglos}%
    [2012/06/27 v1.0 textglos package for inline linguistic glossing]%
\IfFileExists{graphicx}{\RequirePackage{graphicx}}{}%
\global\long\def\tlist@if@empty@nTF #1{%
\expandafter\ifx\expandafter\\\detokenize{#1}\\%
\expandafter\@firstoftwo%
\else%
\expandafter\@secondoftwo%
\fi%
}%
\@ifpackageloaded{graphicx}{%
  \newcommand{\shorteq}{%
    \settowidth{\@tempdima}{-}% Width of hyphen
    \resizebox{1.5\@tempdima}{\height}{=}%
  }%
}{}%
 \def\nbrhyph{\textup{\hbox{-}}}%
 \ifx\shorteq\relax
   \def\nbreq{\textup{\hbox{=}}}%
 \else
   \def\nbreq{\textup{\hbox{\shorteq}}}%
 \fi
 \def\nbrpunct#1{%
   \bgroup
     \catcode`\-=\active
     \catcode`\==\active
     \scantokens{\let-\nbrhyph
         \let=\nbreq#1\ignorespaces}
   \egroup
 }%
\providecommand*{\gl}[1]{`#1'}%
\def\lingexample#1#2{% #1 = name, #2 = template
  \@lingsub(#1)#2\@nil % \@nil as delimiter
  \expandafter\gdef\csname #1\endcsname{% \def\name
    \@ifnextchar[{\@lingexample(#1)}{\@lingexample(#1)[]}%
  }%
}%

\def\@lingsub(#1)#2X#3\@nil{%
  \expandafter\gdef\csname @@lingsub@#1\endcsname##1{\nbrpunct{#2##1#3}}%
}%
\def\@lingexample(#1)[#2]{\@ifnextchar[%
  {\@@lingexample(#1)[#2]}{\@@lingexample(#1)[][#2]}%
}%
\def\@@lingexample(#1)[#2][#3]#4{%
  \ifmmode
    $\tlist@if@empty@nTF{#2}{}{#2~}%
    {\csname @@lingsub@#1\endcsname{#4}}%
    \tlist@if@empty@nTF{#3}{}{ \gl{#3}}$%
  \else
    \tlist@if@empty@nTF{#2}{}{\lingprestyle{{#2}}}%
    {\csname @@lingsub@#1\endcsname{#4}}%
    \tlist@if@empty@nTF{#3}{}{\lingpoststyle{{#3}}}%
  \fi
}%
\providecommand{\lingprestyle}[1]{#1~}
\providecommand{\lingpoststyle}[1]{ \gl{#1}}
\lingexample{xo}{\ensuremath{<}X\ensuremath{>}}
\lingexample{xt}{[X]} % use \lingexample{xt}{\tipaencoding[X]}
                      % if you want IPA
\lingexample{xm}{/X/}
\lingexample{xv}{\itshape X}
\lingexample{xh}{*X} % use \lingexample{xh}{*\textit\bgroup X\egroup}
                     % if you want italicized
