summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/expex-glossonly/expex-glossonly.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-08-17 03:01:02 +0000
committerNorbert Preining <norbert@preining.info>2023-08-17 03:01:02 +0000
commit5248edc6ec87b3acdb196687a1af5b6292c8510a (patch)
treee92a27a946d440a1df987f433ed3ec7490423d42 /macros/latex/contrib/expex-glossonly/expex-glossonly.sty
parentd10719e48fc5cd329e6333041ef31d868fafbdcc (diff)
CTAN sync 202308170300
Diffstat (limited to 'macros/latex/contrib/expex-glossonly/expex-glossonly.sty')
-rw-r--r--macros/latex/contrib/expex-glossonly/expex-glossonly.sty97
1 files changed, 97 insertions, 0 deletions
diff --git a/macros/latex/contrib/expex-glossonly/expex-glossonly.sty b/macros/latex/contrib/expex-glossonly/expex-glossonly.sty
new file mode 100644
index 0000000000..b33b6b41c0
--- /dev/null
+++ b/macros/latex/contrib/expex-glossonly/expex-glossonly.sty
@@ -0,0 +1,97 @@
+\def\EPGL@version{0.6}
+\def\EPGL@date{2023/08/15}
+% 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 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 gb4e and linguex v. \EPGL@version ]
+\DeclareOption*{\PackageWarning{expex-glossonly}{Unknown option `\CurrentOption`}}
+\ProcessOptions
+\RequirePackage{calc}
+\RequirePackage{expex}
+% First define a command to patch the ExPex main gloss command
+% Need to find out if other gloss commands need to be patched.
+\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
+}}
+% First check to see whether we are loaded first
+% Since there is some overlap in commands, gb4e and linguex must be loaded second
+\@ifpackageloaded{linguex}{\PackageError{expex-glossonly}{Please load expex-glossonly BEFORE linguex}{Please load expex-glossonly BEFORE linguex}}{}
+\@ifpackageloaded{gb4e}{\PackageError{expex-glossonly}{Please load expex-glossonly BEFORE gb4e}{Please load expex-glossonly BEFORE gb4e}}{}
+% Now only patch the command if the packages have been loaded
+% This means that the package will do no harm if loaded by itself
+\AtBeginDocument{%
+\@ifpackageloaded{linguex}{
+ \def\EPGL@setglossmargin{%
+ \ifnum\theExDepth=1%
+ \setlength{\leftskip}{\Exindent+\Exlabelsep+\Exlabelwidth+.5em}
+ \else
+ \setlength{\leftskip}{\Exindent+\Exlabelsep+\Exlabelwidth+\SubExleftmargin+.5em}
+ \fi}
+ \EPGL@patchexpexgloss
+ \PackageInfo{expex-glossonly}{Patching ExPex for use with linguex}
+ \typeout{Patching ExPex for use with linguex}
+}
+{\@ifpackageloaded{gb4e}{
+ \def\EPGL@setglossmargin{%
+ \ifnum\@xnumdepth=1%
+ \setlength{\leftskip}{\leftmargin+\widthof{\@exwidth}+1em}
+ \else
+ \setlength{\leftskip}{\leftmargin+\labelwidth+\labelsep+1.5em}
+ \fi}
+ \EPGL@patchexpexgloss
+ \PackageInfo{expex-glossonly}{Patching ExPex for use with gb4e}
+ \typeout{Patching ExPex for use with gb4e}
+}{}}
+}
+\endinput \ No newline at end of file