summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gb4e/gb4e.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/gb4e/gb4e.sty')
-rw-r--r--Master/texmf-dist/tex/latex/gb4e/gb4e.sty49
1 files changed, 44 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/gb4e/gb4e.sty b/Master/texmf-dist/tex/latex/gb4e/gb4e.sty
index b212ba00f61..b156829f61a 100644
--- a/Master/texmf-dist/tex/latex/gb4e/gb4e.sty
+++ b/Master/texmf-dist/tex/latex/gb4e/gb4e.sty
@@ -3,10 +3,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Version 4export (= v. 4 minus the compatibility code)
% Based on hpk's gb.sty, revised for GM syllabus by ct,
-% and incorporating macros adapted from J.Frampton, M. de Groot en M.
-% Covington. Full documentation soon to come in gb4doc.tex. Bug-reports
+% and incorporating macros adapted from J.Frampton, M. van der Goot en M.
+% Covington. Full documentation soon to come in gb4e-doc.tex. Bug-reports
% and suggestions for improvements, other used features, please!
%
+% The package gb4e may be distributed under the conditions of the LaTeX Project
+% Public License (LPPL). See the README file for more details.
+%
% Notes:
%
% Various styles for X-bar levels; can be changed, but note that {picture}
@@ -16,6 +19,11 @@
% This file allows _ and ^ to be used in ordinary text, hence must be
% loaded AFTER any file that uses them in their TeX meaning. Hence
% cgloss(n).sty is loaded early in this file.
+% This feature is known to cause problems but is maintained for backward
+% compatibility. If you have problems, you can try disabling it by
+% placing the command \noautomath immediately after loading the gb4e package.
+% [Added 2009/12/28]
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
@@ -56,7 +64,7 @@
% \sn[jdgmt]{sentence} (unnumbered example with judgement)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% For my own lazyness (HANDLE WITH CARE---this works only
+% For my own laziness (HANDLE WITH CARE---this works only
% in boringly normal cases.... ):
%
% \ea works like \begin{exe}\ex or \begin{xlist}\ex,
@@ -65,7 +73,10 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\@ifundefined{new@fontshape}{\def\reset@font{}\let\mathrm\rm\let\mathit\mit}{}
+% For any REALLY old distributions without \rmfamily
+\@ifundefined{rmfamily}{\let\rmfamily=\rm}
+
+\@ifundefined{new@fontshape}{\def\reset@font{}\let\mathrm\rmfamily\let\mathit\mit}{}
\let\prmbrs=0
\def\primebars{\let\prmbrs=1}
@@ -94,12 +105,40 @@
%%% NEWSTUFF:
\newcommand{\indexgroupmark}[1]{\item{\bf #1}} % ?? -CT
-% this allows _ to be used in horizontal mode (from J.Frampton):
\catcode`_=\active
\def_#1{\ifmmode\mathit{\sb{#1}}\else${}\sb{#1}$\fi}
\catcode`^=\active
\def^#1{\ifmmode\mathit{\sp{#1}}\else${}\sp{#1}$\fi}
+%%%%%%%%%%% AUTOMATH
+
+% this allows _ to be used in horizontal mode (from J.Frampton):
+% Reimplemented to allow this feature to be turned on and off.
+% The new version also combines sub- and superscripts properly.
+% -Alexis
+
+% \automath Make _ and ^ work outside math mode
+% \noautomath Restore normal sub/superscript behavior
+
+{ % Temporarily change catcodes
+ \catcode`\_=\active
+ \catcode`\^=\active
+
+ \global\def\automath{%
+ \catcode`\_=\active
+ \catcode`\^=\active
+ \def_##1{\@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
+ \def^##1{\@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}}
+}
+\def\automath@two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}}
+% Restore default catcodes for ^, _
+\def\noautomath{\catcode`\_=8 \catcode`\^=7 }
+
+\automath % On by default, for backward compatibility
+
+%%%%%%%%%
+
+
\def\lb#1{\@ifnextchar [{\@glarph{#1}}{\@bl{#1}}}
\def\@glarph#1[#2]{\ifmmode{[}\sb{{\mathrm{#1}}\sb{#2}}\else%
${[}\sb{{\mathrm{#1}}\sb{#2}}$\fi}