summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/scrjura.sty
blob: 269e191ecf37bf55beae46b70944512713c084f4 (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
%%
%% This is file `scrjura.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scrjura.dtx  (with options: `package')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2007-2009
%% Markus Kohm and any individual authors listed elsewhere in this file.
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, version 1.3b of the license.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3b or later is part of all distributions of LaTeX
%% version 2005/12/01 or later and of this work.
%% 
%% This work has the LPPL maintenance status "author-maintained".
%% 
%% The Current Maintainer and author of this work is Markus Kohm.
%% 
%% This file may only be distributed together with the files
%% `scrlogo.dtx' and `scrjura.dtx'. You may however distribute the files
%% `scrlogo.dtx' and `scrjura.dtx' without this file.
%% See also `scrjura.dtx' for additional information.
%% 
%% If this file is a beta version, you are not allowed to distribute it.
%% 
%% Currently there is only a short german manual at `scrjura.dtx', that
%% should also be found as `scrjura.pdf'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.
%% 
%%% From File: scrjura.dtx
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{scrjura}
                [2008/01/23 v0.4b alpha
                (package)%
                ]

\@ifpackageloaded{hyperref}{%
  \PackageError{scrjura}{Package hyperref already loaded}{%
    If you want to use package scrjura with package hyperref, you have to
    use\MessageBreak
    package scrjura before package hyperref.\MessageBreak
    To solve the problem, you just should move the loading of package
    hyperref\MessageBreak
    behind the loading of package scrjura.}%
}
\DeclareOption{contract}{%
  \g@addto@macro\document\contract%
}
\newif\if@juratotoc
\DeclareOption{juratotoc}{\@juratotoctrue}
\newcommand*{\Paragraphmark}[1]{}
\DeclareOption{markright}{%
  \renewcommand*{\Paragraphmark}[1]{\markright{#1}}%
}
\DeclareOption{markboth}{%
  \renewcommand*{\Paragraphmark}[1]{\markboth{#1}{#1}}%
}
\DeclareOption{parcitename}{%
  \AtEndOfPackage{\renewcommand*{\parciteformat}[1]{\parname~#1}}%
}
\DeclareOption{sentencecitename}{%
  \AtEndOfPackage{\renewcommand*{\sentenceciteformat}[1]{\sentencename~#1}}%
}
\ProcessOptions\relax
\RequirePackage{keyval}
\newcommand*{\contract}{%
  \renewcommand*{\contract}{%
    \contract@nest@error{contract}%
  }%
  \let\@doendpe\contract@doendpe
  \let\Paragraph\contract@paragraph
  \let\c@Paragraph\c@contractParagraph
  \edef\cl@Paragraph{\cl@Paragraph\cl@contractParagraph}%
  \let\SubParagraph\contract@subparagraph
  \let\c@SubParagraph\c@contractSubParagraph
  \edef\cl@SubParagraph{\cl@SubParagraph\cl@contractSubParagraph}%
  \let\Par\contract@everypar
  \let\Sentence\contract@sentence
}
\let\if@jura@skiphyperref\iftrue
\let\cl@Paragraph\@empty
\let\cl@SubParagraph\@empty
\newcounter{contractParagraph}
\renewcommand*{\thecontractParagraph}{%
  {\S~\arabic{contractParagraph}}}
\newcounter{contractSubParagraph}
\@addtoreset{SubParagraph}{Paragraph}
\renewcommand*{\thecontractSubParagraph}{%
  {\theParagraph\alph{contractSubParagraph}}}
\define@key{contract}{title}{%
  \def\contract@title{#1}%
  \ifx\contract@entry\relax\def\contract@entry{\contract@title}\fi
  \ifx\contract@head\relax\def\contract@head{\contract@title}\fi
}
\define@key{contract}{entry}{\def\contract@entry{#1}}
\define@key{contract}{noentry}[]{\let\contract@entry\relax}
\define@key{contract}{head}{\def\contract@head{#1}}
\define@key{contract}{nohead}[]{\let\contract@head\relax}
\define@key{contract}{number}{\def\contract@number{#1}}
\newcommand*{\contract@preskip}{2\baselineskip}
\newcommand*{\contract@postskip}{\baselineskip}
\define@key{contract}{preskip}{\def\contract@preskip{#1}}
\define@key{contract}{postskip}{\def\contract@postskip{#1}}
\newif\ifcontract@dummy
\define@key{contract}{dummy}[true]{\csname contract@dummy#1\endcsname}
\newcommand*{\contract@paragraph@font}{\sffamily\bfseries\large\@hangfrom}
\newcounter{@AbsParagraph}
\newcommand*{\theH@AbsParagraph}{P-\arabic{@AbsParagraph}}
\newcommand*{\theHParagraph}{\theH@AbsParagraph}
\newcommand*{\theHSubParagraph}{\theH@AbsParagraph}
\newcommand*{\contract@paragraph}[1]{%
  \ManualPar\parnumbertrue
  \let\contract@title\relax
  \let\contract@entry\relax
  \let\contract@head\relax
  \let\contract@number\relax
  \contract@dummyfalse
  \ifx\relax#1\relax\else\setkeys{contract}{#1}\fi
  \ifcontract@dummy\else
    \@afterindentfalse
    \addvspace{\contract@preskip}%
  \fi
  \ifx\contract@number\relax
    \let\p@Paragraph\@empty
    \let\theParagraph\thecontractParagraph
    \refstepcounter{Paragraph}%
  \else
    \begingroup
      \let\@elt\@stpelt
      \cl@Paragraph
    \endgroup
    \protected@edef\theParagraph{\S~\contract@number}%
    \protected@edef\@currentlabel{\theParagraph}%
  \fi
  \stepcounter{@AbsParagraph}%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname if@skiphyperref\endcsname\relax
  \else
    \expandafter\let\csname if@jura@skiphyperref\expandafter\endcsname
    \csname if@skiphyperref\endcsname
  \fi
  \if@jura@skiphyperref\else
    \hyper@refstepcounter{@AbsParagraph}%
    \typeout{absolute Nummer: \the@AbsParagraph^^JLabel: `\@currentHref'}%
  \fi
  \let\theSubParagraph\theParagraph
  \ifcontract@dummy\else
    \begingroup
      \contract@paragraph@font \theParagraph
      \ifx\contract@title\relax\else\enskip\contract@title\fi
    \endgroup
    \ifx\contract@entry\relax\else
      \addcontentsline{toc}{cpar}{%
        \protect\numberline{\theParagraph}\contract@entry
      }%
      \addcontentsline{cpa}{cpar}{%
        \protect\numberline{\theParagraph}\contract@entry
      }%
    \fi
    \ifx\contract@head\relax\else
      \expandafter\Paragraphmark\expandafter{%
        \expandafter\theSubParagraph\expandafter\enskip\contract@head}%
    \fi
    \par\nobreak\vskip\contract@postskip
    \jura@afterheading{contract}%
  \fi
}
\newcommand*{\contract@subparagraph}[1]{%
  \ManualPar\parnumbertrue
  \let\contract@title\relax
  \let\contract@entry\relax
  \let\contract@head\relax
  \let\contract@number\relax
  \contract@dummyfalse
  \ifx\relax#1\relax\else\setkeys{contract}{#1}\fi
  \ifcontract@dummy\else
    \@afterindentfalse
    \vskip\contract@preskip
  \fi
  \ifx\contract@number\relax
    \let\p@SubParagraph\@empty
    \let\theSubParagraph\thecontractSubParagraph
    \refstepcounter{SubParagraph}%
  \else
    \begingroup
      \let\@elt\@stpelt
      \cl@SubParagraph
    \endgroup
    \protected@edef\theSubParagraph{\theParagraph\contract@number}%
    \protected@edef\@currentlabel{\theSubParagraph}%
  \fi
  \stepcounter{@AbsParagraph}%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname if@skiphyperref\endcsname\relax
  \else
    \expandafter\let\csname if@jura@skiphyperref\expandafter\endcsname
    \csname if@skiphyperref\endcsname
  \fi
  \if@jura@skiphyperref\else
    \hyper@refstepcounter{@AbsParagraph}%
    \typeout{absolute Nummer: \the@AbsParagraph^^JLabel: `\@currentHref'}%
  \fi
  \ifcontract@dummy\else
    \begingroup
      \contract@paragraph@font \theSubParagraph
      \ifx\contract@title\relax\else\enskip\contract@title\fi
    \endgroup
    \ifx\contract@entry\relax\else
      \addcontentsline{toc}{cpar}{%
        \protect\numberline{\theSubParagraph}\contract@entry
      }%
      \addcontentsline{cpa}{cpar}{%
        \protect\numberline{\theSubParagraph}\contract@entry
      }%
    \fi
    \ifx\contract@head\relax\else
      \expandafter\Paragraphmark\expandafter{%
        \expandafter\theSubParagraph\expandafter\enskip\contract@head}%
    \fi
    \par\nobreak\vskip\contract@postskip
    \jura@afterheading{contract}%
  \fi
}
\newcommand*{\AutoPar}{%
  \expandafter\let\expandafter\jura@everypar
  \csname \jura@type @everypar\endcsname
}
\newcommand*{\ManualPar}{%
  \let\jura@everypar\relax
}
\newcommand*{\jura@afterheading}[1]{%
  \@nobreaktrue
  \everypar{%
    \if@nobreak
      \@nobreakfalse
      \clubpenalty \@M
      \if@afterindent \else
        {\setbox\z@\lastbox}%
      \fi
    \else
      \clubpenalty \@clubpenalty
      \everypar{%
        \jura@everypar
      }%
    \fi
    \jura@everypar
  }%
  \def\jura@type{#1}%
  \AutoPar
}
\newcommand*{\jura@everypar}{}
\CheckCommand*\@doendpe{\@endpetrue
  \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar
  {{\setbox\z@\lastbox}\everypar{}\@endpefalse}}
\newcommand*{\contract@doendpe}{%
  \@endpetrue
  \def\par{%
    \@restorepar\everypar{%
      \csname jura@everypar\endcsname
    }%
    \par\@endpefalse
  }%
  \everypar{%
    {\setbox\z@\lastbox}\everypar{%
      \csname jura@everypar\endcsname
    }%
    \@endpefalse
  }%
}
\newcommand*{\l@cpar}[2]{%
  \if@juratotoc
    \@dottedtocline{\value{juratoclevel}}{1.5em}{2em}{#1}{#2}%
  \fi
}
\newcounter{juratoclevel}
\setcounter{juratoclevel}{2}%
\DeclareRobustCommand*{\jura@separator}[1]{#1}
\newif\ifparnumber
\newcounter{par}
\renewcommand*{\thepar}{\arabic{par}}
\newcommand*{\theHpar}{\theH@AbsParagraph-\Roman{par}}
\newcommand*{\parformat}{(\thepar)}
\renewcommand*\p@par{{\theSubParagraph\jura@separator{\nobreakspace}}}
\@addtoreset{par}{Paragraph}
\@addtoreset{par}{SubParagraph}
\newcommand*{\contract@everypar}{%
  \ifparnumber
    \refstepcounter{par}%
    \refstepcounter{sentence}%
    \begingroup
      \protected@write\@auxout{}{%
        \string\newmaxpar{contractpars}{\theSubParagraph}{\arabic{par}}}%
      \getmaxpar\@tempa{contractpars}{\theSubParagraph}%
      \typeout{Stored max is \@tempa}%
      \ifnum \@tempa>\@ne
        \parformat\nobreakspace
      \fi
    \endgroup
  \else
    \setcounter{sentence}{0}\refstepcounter{sentence}%
  \fi
}
\newcommand*{\refParagraph}[1]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
    \ref{#1}%
  \else
    \begingroup
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#1\endcsname}%
      \def\@tempc##1##2\@nil{##1}%
      \let\jura@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#1\endcsname\noexpand\@nil}%
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#1\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref{#1}%
    \endgroup
  \fi
}
\newcommand*{\refPar}[1]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
    \ref{#1}%
  \else
    \begingroup
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#1\endcsname}%
      \def\@tempc##1##2\@nil{##1}%
      \let\jura@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#1\endcsname\noexpand\@nil}%
      \def\@tempc##1##2##3\@nil{##2}%
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa{%
          \protect\G@refundefinedtrue
          \nfss@text{\reset@font\bfseries ??}%
          \@latex@warning{Reference `#1' on page \thepage \space
            with undefined par number}%
        }\noexpand\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#1\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref{#1}%
    \endgroup
  \fi
}
\newcommand*{\refSentence}[1]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
    \ref{#1}%
  \else
    \begingroup
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#1\endcsname}%
      \def\@tempc##1##2\@nil{##1}%
      \let\jura@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#1\endcsname\noexpand\@nil}%
      \def\@tempc##1##2##3##4\@nil{##3}%
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa{}{%
          \protect\G@refundefinedtrue
          \nfss@text{\reset@font\bfseries ??}%
          \@latex@warning{Reference `#1' on page \thepage \space
            with undefined sentence number}%
        }\noexpand\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#1\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref{#1}%
    \endgroup
  \fi
}
\newcounter{sentence}[par]
\renewcommand*{\thesentence}{\arabic{sentence}}
\newcommand*{\theHsentence}{\theHpar-\arabic{sentence}}
\renewcommand*{\p@sentence}{\expandafter\p@@sentence}
\newcommand*{\p@@sentence}[1]{\p@par{{\par@cite{\thepar}}%
    \jura@separator{\nobreakspace}}{\sentence@cite{#1}}}
\newcommand*{\contract@sentence}{%
  \refstepcounter{sentence}%
  \ensuremath{^{\mbox{\fontsize\sf@size\z@\selectfont\thesentence}}}%
}
\DeclareRobustCommand*{\par@cite}[1]{\parciteformat{#1}}
\newcommand*{\parciteformat}[1]{\@Roman{\numexpr #1\relax}}
\DeclareRobustCommand*{\sentence@cite}[1]{\sentenceciteformat{#1}}
\newcommand*{\sentenceciteformat}[1]{\@arabic{\numexpr #1\relax}}
\newcommand*{\parname}{Paragraph}
\AtBeginDocument{%
  \@ifundefined{captionsgerman}{}{%
    \addto\captionsgerman{\def\parname{Absatz}}%
    \addto\captionsgerman{\def\sentencename{Satz}}%
    \ifnum \l@german=\language\selectlanguage{german}\fi
  }%
  \@ifundefined{captionsngerman}{}{%
    \addto\captionsngerman{\def\parname{Absatz}}%
     \addto\captionsngerman{\def\sentencename{Satz}}%
   \ifnum \l@ngerman=\language\selectlanguage{ngerman}\fi
  }%
}
\newcommand*{\newmaxpar}[3]{%
  \begingroup
    \protected@edef\@tempa{#2}\@onelevel@sanitize\@tempa
    \expandafter\xdef\csname max@#1@\@tempa\endcsname{#3}%
  \endgroup
}
\newcommand*{\getmaxpar}[3]{%
  \begingroup
    \protected@edef\@tempa{#3}%
    \@onelevel@sanitize\@tempa
    \expandafter\ifx \csname max@#2@\@tempa\endcsname\relax
      \edef\@tempa{\endgroup\edef\noexpand#1{\expandafter\the\value{par}}}%
    \else
      \edef\@tempa{\endgroup
        \edef\noexpand#1{\csname max@#2@\@tempa\endcsname}}%
    \fi
  \@tempa
}
%%% From File: scrlogo.dtx
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `scrjura.sty'.