summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eledform/eledform.sty
blob: 1ac9d51dce077dd08adcee6b73cb3ae9c12df20c (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%%
%% This is file `eledform.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% eledform.dtx  (with options: `package')
%% Copyright (C) 2012 by Maïeul Rouquette
%% 
%% This file 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 2003/06/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eledform}[2015/08/13 v1.1a formalism for eledmac]
\RequirePackage{eledmac}
\def\manuscripts@{}
\newcommand{\manuscript}[1]{%
    \renewcommand{\do}[1]{\listgadd{\manuscripts@}{##1}}%
    \docsvlist{#1}%
}
\newcommandx*{\var}[5][1,5,usedefault]{%
    \edtext{#2}{%
        \ifstrempty{#1}{}{\lemma{#1}}%
        \varnote@{%
        \ifdefstring{\omitposition@}{first}{
            \ifstrempty{#3}{}%
                {\del@{#3}%
                \ifstrempty{#4}%
                    {}%
                    {\varseparator@}%
                }%
                    \var@{#4}%
            }%
            {%
            \ifstrempty{#4}%
                    {}%
                    {\var@{#4}%
                    \ifstrempty{#3}%
                        {}%
                        {\varseparator@}%
                    }%
            \ifstrempty{#3}{}{\del@{#3}}%
            }%
        }%
    #5%
    }%
}
\newcommand{\print@manuscript}[1]{%
    \ifinlist{#1}{\manuscripts@}%
        {#1}%
        {\eledmac@warning{Manuscript #1 not declared, p.\the\page@num  ; l.\the\line@num}\underline{Manuscript #1 not declared!}}%
    }
\newcommand{\del@}[1]{%
    \renewcommand{\do}[1]{%
        \print@manuscript{##1}%
    }%
    \ifdefstring{\manposition@}{last}%
            {\omittext@\manvarseparator@\docsvlist{#1}}%
            {\docsvlist{#1}\manvarseparator@\omittext@}%
}
\newcommand{\var@}[1]{%
    \newif\iffirst%
    \firsttrue%
    \renewcommand{\do}[1]{\iffirst\firstfalse\else\varseparator@\fi{\var@@##1}}%
    \docsvlist{#1}%
    }
\newcommand{\var@@}[2]{%
    \renewcommand{\do}[1]{%
        \print@manuscript{##1}%
        }%
    \ifdefstring{\manposition@}{last}%
            {#2\manvarseparator@\docsvlist{#1}}%
            {\docsvlist{#1}\manvarseparator@#2}%
    }
\let\varnote@\Afootnote
\newcommand{\varseries}[1]{\letcs{\varnote@}{#1footnote}}
\newcommand{\new@eledform@custom}[2]{%
    \csgdef{#1@}{#2}%
    \expandafter\newcommand\csname#1\endcsname[1]{\csgdef{#1@}{##1}}%
}
\new@eledform@custom{omitposition}{first}
\new@eledform@custom{manposition}{last}
\new@eledform@custom{omittext}{\emph{omit}}
\new@eledform@custom{manvarseparator}{~}
\new@eledform@custom{varseparator}{\space}
\endinput
%%
%% End of file `eledform.sty'.