summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gfdl/gfdl.sty
blob: 080f131600096b9b2a7d152c1a5cdf979d9388a1 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
%%
%% This is file `gfdl.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gfdl.dtx  (with options: `package')
%% ----------------------------------------------------------
%% Package:      gfdl
%% Version:      v0.1 (January 1, 2023)
%% Author:       निरंजन
%% Description:  Enhanced support for linguistics.
%% Repository:   https://puszcza.gnu.org.ua/projects/gfdl
%% License:      GPLv3+, GFDLv1.3+
%% ----------------------------------------------------------
%% 
%% The LaTeX package gfdl v0.1
%% Copyright © 2022, 2023 निरंजन
%% 
%% This program is free software: you can redistribute it
%% and/or modify it under the terms of the GNU General Public
%% License as published by the Free Software Foundation, either
%% version 3 of the License, or (at your option) any later
%% version.
%% 
%% This program is distributed in the hope that it will be
%% useful, but WITHOUT ANY WARRANTY; without even the implied
%% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
%% PURPOSE. See the GNU General Public License for more
%% details.
%% 
%% You should have received a copy of the GNU General Public
%% License along with this program. If not, see
%% <https://www.gnu.org/licenses/>.
%% ----------------------------------------------------------
\ProvidesPackage{gfdl}[2023/01/01 v0.1
For using the GFDL in LaTeX.]
\RequirePackage{float}
\RequirePackage{expkv-def,expkv-opt}
\newif\ifgfdl@copyrightholdersgiven
\gfdl@copyrightholdersgivenfalse
\newif\ifgfdl@copyrightableyearsgiven
\gfdl@copyrightableyearsgivenfalse
\newif\ifgfdl@copyrightedmaterialdesc
\gfdl@copyrightedmaterialdescfalse
\newif\ifgfdl@licensetextnotprinted
\gfdl@licensetextnotprintedtrue
\newif\ifgfdl@noticenotprinted
\gfdl@noticenotprintedtrue
\ekvdefinekeys{gfdl}{
  invbool     manual     = {\ifgfdl@printgfdl},
  bool        (C)        = {\ifgfdl@bracketedcopyright},
  choice      version    = {%
    1.1                  = {\def\gfdl@version{1p1}},%
    1.2                  = {\def\gfdl@version{1p2}},%
    1.3                  = {\def\gfdl@version{1p3}}%
  },
  initial     version    = {1.3}
}
\ekvoProcessLocalOptions{gfdl}
\ifgfdl@bracketedcopyright
  \def\gfdl@copyrightsymbol{(C)}%
\else
  \let\gfdl@copyrightsymbol\textcopyright
\fi
\NewDocumentCommand{ \gfdlcopyrightdescription }{ m }{%
  \def\@copyrightedmaterialdesc{#1}%
  \gfdl@copyrightedmaterialdesctrue
}
\NewDocumentCommand{ \gfdlcopyrightableyears }{ m }{%
  \def\@copyrightableyears{#1}%
  \gfdl@copyrightableyearsgiventrue
}
\NewDocumentCommand{ \gfdlcopyrightholders }{ m }{%
  \def\@copyrightholders{#1}%
  \gfdl@copyrightholdersgiventrue
}
\AddToHook{begindocument/before}{%
  \ifgfdl@copyrightableyearsgiven
  \else
    \def\@copyrightableyears{\textbf{??}}%
    \PackageWarningNoLine{gfdl}{%
      Copyright-able years not given. I can't print the
      \MessageBreak
      copyright notice without them. To give me this
      \MessageBreak
      information use the \string\gfdlcopyrightableyears\space
      command.\MessageBreak Using `??' as a placeholder%
    }%
  \fi
  \ifgfdl@copyrightholdersgiven
  \else
    \def\@copyrightholders{\textbf{??}}%
    \PackageWarningNoLine{gfdl}{%
      Copyright-holders not given. I can't print the
      \MessageBreak
      copyright notice without them. To give me this
      \MessageBreak
      information use the \string\gfdlcopyrightholders\space
      command.\MessageBreak Using `??' as a placeholder%
    }%
  \fi
  \@ifpackageloaded{csquotes}{}{%
    \RequirePackage{csquotes}%
  }%
  \@ifpackageloaded{hyperref}{}{%
    \RequirePackage{hyperref}%
  }%
  \@ifpackageloaded{hyperxmp}{}{%
    \RequirePackage{hyperxmp}%
  }%
  \hypersetup{%
    pdfcopyright  = {%
      \ifgfdl@copyrightedmaterialdesc
        \@copyrightedmaterialdesc
        \textLF
      \fi
      Copyright
      \gfdl@copyrightsymbol\
      \@copyrightableyears\
      \@copyrightholders\textLF
      Permission is granted to copy, distribute and/or
      modify this document under the terms of the GNU Free
      Documentation License, Version 1.3 or any later
      version published by the Free Software Foundation;
      with no Invariant Sections, no Front-Cover Texts, and
      no Back-Cover Texts. A copy of the license is included
      in the section entitled “GNU Free Documentation
      License”.%
    },%
    pdflicenseurl = {%
      https://www.gnu.org/licenses/fdl-1.3.txt%
    }%
  }%
}
\newfloat{gfdl@float}{b}{delme}
\NewDocumentCommand{ \printgfdlnotice }{  }{%
  \begin{gfdl@float}[b!]
    \hrule\medskip
    \ifgfdl@copyrightedmaterialdesc
      \@copyrightedmaterialdesc\par
    \fi
    Copyright
    \gfdl@copyrightsymbol\
    \@copyrightableyears\
    \@copyrightholders

    Permission is granted to copy, distribute and/or modify
    this document under the terms of the GNU Free
    Documentation License, Version 1.3 or any later version
    published by the Free Software Foundation; with no
    Invariant Sections, no Front-Cover Texts, and no
    Back-Cover Texts. A copy of the license is included in
    the section entitled \enquote{%
      GNU Free Documentation License%
    }.%
  \end{gfdl@float}%
  \gfdl@noticenotprintedfalse
}
\AddToHook{begindocument/end}{%
  \ifgfdl@printgfdl
    \printgfdlnotice
  \fi
}
\NewDocumentCommand{ \printgfdltext }{  }{%
  \input{gfdl-tex-\gfdl@version.tex}%
  \gfdl@licensetextnotprintedfalse
}
\AddToHook{enddocument}{%
  \ifgfdl@printgfdl
    \newpage
    \phantomsection
    \addcontentsline{toc}{section}{%
      GNU Free Documentation License%
    }%
    \printgfdltext
  \fi
  \ifgfdl@noticenotprinted
    \PackageError{gfdl}{%
      You didn't print the copyright notice%
    }{%
      You are in the `manual' mode of the GFDL package and
      hence you\MessageBreak are supposed to print the
      copyright notice at a suitable place\MessageBreak of
      your choice, but you haven't printed it at all. This
      violates\MessageBreak the requirement of the GFDL. To
      print it use:\MessageBreak
      \space\space\string\printgfdlnotice.%
    }%
  \fi
  \ifgfdl@licensetextnotprinted
    \PackageError{gfdl}{%
      You didn't print the license text%
    }%
    {%
      You are in the `manual' mode of the GFDL package and hence you%
      \MessageBreak
      are supposed to print the full license text at a suitable place%
      \MessageBreak
      of your choice, but you haven't printed it at all. This violates%
      \MessageBreak
      the requirement of the GFDL. To print it use:%
      \MessageBreak
      \space\space\string\printgfdltext.%
    }%
  \fi
}
\endinput
%%
%% End of file `gfdl.sty'.