summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gb4e-next/gb4e-next.sty
blob: 5974f21feb70d5c726a88685b52439e783b889ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\def\gbnext@version{0.5}
\def\gbnext@date{2024-10-27}
% The gb4e-next package  provides gb4e users two relative example reference commands. \Next refers to the next 
% example in the document and \Prev refers to the previous example. No explicit label command is required.
%
% Copyright 2024 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 gb4e-next.sty and documentation files                
% gb4e-next.tex and gb4e-next.pdf.
%
% This package is currently experimental. Use at your own risk.
%
\ProvidesPackage{gb4e-next}[\gbnext@date\ Provides relative example reference to gb4e v. \gbnext@version ]
\RequirePackage{gb4e}
\DeclareKeys[gb4e-next]{
fn.store = \gbnext@fnformat
}
\SetKeys[gb4e-next]{fn=roman}
\ProcessKeyOptions[gb4e-next]
\newcounter{gbnext@tmpcnt}
\NewDocumentCommand{\Next}{o}{%
\IfNoValueTF{#1}%
{\save@exx}%
{\save@exx[#1]}%
\stepcounter{gbnext@tmpcnt}\printExNo}
\NewDocumentCommand{\Prev}{o}{%
\IfNoValueTF{#1}%
{\save@exx}%
{\save@exx[#1]}%
\printExNo}
\NewDocumentCommand{\save@exx}{o}{%
\if@noftnote%
\setcounter{gbnext@tmpcnt}{\value{exx}}%
\IfNoValueTF{#1}%
{\def\thegbnext@tmpcnt{\arabic{gbnext@tmpcnt}}}% default format of printed number
{\def\thegbnext@tmpcnt{\csname#1\endcsname{gbnext@tmpcnt}}}%
\else%
\setcounter{gbnext@tmpcnt}{\value{fnx}}%
\IfNoValueTF{#1}%
{\def\thegbnext@tmpcnt{\csname\gbnext@fnformat\endcsname{gbnext@tmpcnt}}}% default format of printed number
{\def\thegbnext@tmpcnt{\csname#1\endcsname{gbnext@tmpcnt}}}%
\fi}
\newcommand\printExNo{(\thegbnext@tmpcnt)}
\endinput