summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/japanlco.dtx
blob: c794644aeffa4fd8d4626fa6959b1043c5eaf0eb (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
% \iffalse meta-comment
% ======================================================================
% japanlco.dtx
% Copyright (c) Markus Kohm, 2008-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c 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 work consists of all files listed in manifest.txt.
% ======================================================================
%%% From File: $Id: japanlco.dtx 3690 2022-02-10 09:59:31Z kohm $
%<Ni&EARLY&LOW&head>%%%            (run: Ni,EARLY,LOW,head)
%<Ni&EARLY&LOW&body>%%%            (run: Ni,EARLY,LOW,body)
%<Ni&EARLY&HIGH&head>%%%            (run: Ni,EARLY,HIGH,head)
%<Ni&EARLY&HIGH&body>%%%            (run: Ni,EARLY,HIGH,body)
%<Ni&LATE&LOW&head>%%%            (run: Ni,LATE,LOW,head)
%<Ni&LATE&LOW&body>%%%            (run: Ni,LATE,LOW,body)
%<Ni&LATE&HIGH&head>%%%            (run: Ni,LATE,HIGH,head)
%<Ni&LATE&HIGH&body>%%%            (run: Ni,LATE,HIGH,body)
%<Ni&RIGHT&LOW&head>%%%            (run: Ni,RIGHT,LOW,head)
%<Ni&RIGHT&LOW&body>%%%            (run: Ni,RIGHT,LOW,body)
%<Kaku&LATE&LOW&head>%%%            (run: Kaku,LATE,LOW,head)
%<Kaku&LATE&LOW&body>%%%            (run: Kaku,LATE,LOW,body)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
  \filedate$Date: 2022-02-10 10:59:31 +0100 (Do, 10. Feb 2022) $
  \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
  \filerevision$Revision: 3690 $
\endgroup
\ProvidesFile{japanlco.dtx}[\filedate\space\filerevision\space
                            KOMA-Script (letter class options)]
\ifx\documentclass\undefined
  \ifx\ifTopLevel\undefined
    \input scrdocstrip.tex
    \@@input scrkernel-version.dtx
    \@@input scrstrip.inc
    \KOMAdefVariable{COPYRIGHTFROM}{2007}
    \generate{\usepreamble\defaultpreamble
      \file{NipponEL.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Ni,EARLY,LOW,head}%
        \from{japanlco.dtx}{lco,Ni,EARLY,LOW,body}%
      }%
      \file{NipponEH.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Ni,EARLY,HIGH,head}%
        \from{japanlco.dtx}{lco,Ni,EARLY,HIGH,body}%
      }%
      \file{NipponLL.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Ni,LATE,LOW,head}%
        \from{japanlco.dtx}{lco,Ni,LATE,LOW,body}%
      }%
      \file{NipponLH.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Ni,LATE,HIGH,head}%
        \from{japanlco.dtx}{lco,Ni,LATE,HIGH,body}%
      }%
      \file{NipponRL.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Ni,RIGHT,LOW,head}%
        \from{japanlco.dtx}{lco,Ni,RIGHT,LOW,body}%
      }%
      \file{KakuLL.lco}{%
        \from{scrkernel-version.dtx}{trace}%
        \from{japanlco.dtx}{lco,Kaku,LATE,LOW,head}%
        \from{japanlco.dtx}{lco,Kaku,LATE,LOW,body}%
      }%
    }%
    \@@input scrstrop.inc
  \fi
\else
  \let\endbatchfile\relax
\fi
\endbatchfile  
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\usepackage{graphicx}
\begin{document}
  \DocInput{japanlco.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v2.98}{2007/11/13}{first version based on lco files from Gernot
%   Hassenpflug}
% \changes{v3.36}{2022/01/21}{switch over to \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/01/21}{using \cs{setplength} and \cs{addtoplength}
%   instead of \cs{@setplength} and \cs{@addtoplength}}
% \changes{v3.36}{2022/02/02}{self-extracting}
% \changes{v3.36}{2022/02/02}{extended documentation}
%
% \GetFileInfo{japanlco.dtx}
% \title{\href{https://komascript.de}{\KOMAScript} \partname\
%   \texttt{\filename}}
% \date{Version \fileversion{} of \filedate}
% \author{Markus Kohm}
% \maketitle
% \tableofcontents
%
% \section{Option Files for Japanese Letters}
%
% Gernot Hassenpflug wrote a lot of \file{lco}-files for use of Japanese
% envelope formats.  Markus Kohm, the author of \KOMAScript, adapted them to
% an extended version of \cls*{scrlttr2} and wrote a \file{dtx}-file with the
% moste recent \file{lco}-files. Table~\ref{tab:japan.envelopes} shows all
% \file{lco}-files of the supported envelopes with their datas.
%
% \begin{table}
% \begin{tabular}{@{}llllllll@{}}
% \hline
% \file{lco}-file & \multicolumn3{l}{Envelope} & \multicolumn4{l@{}}{Window} \\
%          & Name & Length  & Width   & H-pos  & V-pos  & Width & Height\\
% \cline{1-3}\cline{4-8}
% \texttt{NipponEL} & 
%     Chou/You 3 & 235\,mm & 120\,mm & 22\,mm & 12\,mm & 90\,mm & 45\,mm \\
% \texttt{NipponEH} & 
%     Chou/You 3 & 235\,mm & 120\,mm & 22\,mm & 12\,mm & 90\,mm & 55\,mm \\
% \texttt{NipponLL} & 
%     Chou/You 3 & 235\,mm & 120\,mm & 25\,mm & 12\,mm & 90\,mm & 45\,mm \\
% \texttt{NipponLH} & 
%     Chou/You 3 & 235\,mm & 120\,mm & 25\,mm & 12\,mm & 90\,mm & 55\,mm \\
% \texttt{NipponEL} & 
%     Chou/You 4 & 205\,mm &  90\,mm & 22\,mm & 12\,mm & 90\,mm & 45\,mm \\
% \texttt{NipponEH} & 
%     Chou/You 4 & 205\,mm &  90\,mm & 22\,mm & 12\,mm & 90\,mm & 55\,mm \\
% \texttt{NipponLL} & 
%     Chou/You 4 & 205\,mm &  90\,mm & 25\,mm & 12\,mm & 90\,mm & 45\,mm \\
% \texttt{NipponLH} & 
%     Chou/You 4 & 205\,mm &  90\,mm & 25\,mm & 12\,mm & 90\,mm & 55\,mm \\
% \texttt{NipponRL} &
%     Chou/You 4 & 205\,mm &  90\,mm & 98\,mm & 28\,mm & 90\,mm & 45\,mm \\
% \texttt{KakuLL} &
%     Kaku-kata  & 312\,mm & 228\,mm & 25\,mm & 24\,mm & 90\,mm & 45\,mm \\
% \hline
% \end{tabular}
% \caption{The supported Japanese envelopes}
% \label{tab:japan.envelopes}
% \end{table}
%
% \iftrue
% The following pages show images of example envelopes. For more information
% see the English \file{scrguien.pdf} or the German \file{scrguide.pdf}.
%
% \newcommand\japanenvelope[7]{%
%   \begingroup
%     \setlength{\unitlength}{1mm}%^^A
%     \rotatebox{90}{\begin{picture}(#1,#2)
%       \thinlines
%       \put(0,0){^^A
%         \framebox(#1,#2){}%^^A
%       }%^^A
%       \put(5,5){\texttt{#7}: #1\,mm$\times$#2\,mm (B$\times$H)}%^^A
%       \csname @tempcnta\endcsname #2 
%       \advance\csname @tempcnta\endcsname -#4
%       \put(0,\csname @tempcnta\endcsname){\vector(1,0){#3}}%^^A
%       \put(#3,\csname @tempcnta\endcsname){\vector(-1,0){#3}}%^^A
%       \put(0,\csname @tempcnta\endcsname){^^A
%         \makebox(#3,\baselineskip\csname @gobble\endcsname){#3\,mm}}%^^A
%       \put(#3,#2){\vector(0,-1){#4}}%^^A
%       \put(#3,\csname @tempcnta\endcsname){\vector(0,1){#4}}%^^A
%       \put(#3,\csname @tempcnta\endcsname){^^A
%         \makebox(0,#4)[l]{~#4\,mm}}
%       \advance\csname @tempcnta\endcsname -#6
%       \put(#3,\csname @tempcnta\endcsname){^^A
%         \framebox(#5,#6){}%^^A
%       }%^^A
%       \put(#3,\csname @tempcnta\endcsname){^^A
%         \makebox(0,5)[l]{~#5\,mm$\times$#6\,mm (B$\times$H)}%^^A
%       }%^^A
%     \end{picture}}
%   \endgroup
% }
%
% \expandafter\ifx\csname rotatebox\endcsname\relax\else
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{235}{120}{22}{12}{90}{45}{Chou 3 EL}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{235}{120}{22}{12}{90}{55}{Chou 3 EH}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{235}{120}{25}{12}{90}{45}{Chou 3 LL}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{235}{120}{25}{12}{90}{55}{Chou 3 LH}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{205}{90}{22}{12}{90}{45}{Chou 4 EL}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{205}{90}{22}{12}{90}{55}{Chou 4 EH}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{205}{90}{25}{12}{90}{45}{Chou 4 LL}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{205}{90}{25}{12}{90}{55}{Chou 4 LH}}%
% \clearpage
% \vspace*{\fill}\smash{\japanenvelope{205}{90}{98}{28}{90}{45}{Chou 4 RL}}%
% \clearpage
% \fi
%\fi
%
% \StopEventually{\PrintIndex}
%
% \section{Implementation}
%    \begin{macrocode}
%<*lco>
%    \end{macrocode}
%
% \subsection{The File Header}
%
% Declaration of the file.
%    \begin{macrocode}
%<*head>
\ProvidesFile{%
%<Ni>  Nippon%
%<Kaku>  Kaku%
%<EARLY>  E%
%<LATE>  L%
%<RIGHT>  R%
%<LOW>  L%
%<HIGH>  H%
}[%
%!KOMAScriptVersion
Japanese letter-class-option]
%    \end{macrocode}
%
% \begin{command}{\LCOWarningNoLine}
% \begin{command}{\LCOWarning}
% We need macros that are similar to |\ClassWarningNoLine| or
% |\PackageWarningNoLine| and |\ClassWarning| or |\PackageWarning|
%    \begin{macrocode}
\providecommand*\LCOWarningNoLine[2]{%
  \LCOWarning{#1}{#2\@gobble}%
}
\providecommand*\LCOWarning[2]{%
  \GenericWarning{%
    (#1)\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces
  }{%
    Letter class option  #1 Warning: #2%
  }%
}
%</head>
%    \end{macrocode}
% \end{command}
% \end{command}
%
%
% \subsection{Main-Part}
%
% Check the class.
% \changes{v3.25a}{2018/04/17}{check not only for \cls*{scrlttr2} but also
%   for \pkg*{scrletter}}%^^A
%    \begin{macrocode}
%<*body>
\@ifundefined{scr@fromname@var}{%
  \LCOWarningNoLine{%
%<Ni>  Nippon%
%<Kaku>  Kaku%
%<EARLY>  E%
%<LATE>  L%
%<RIGHT>  R%
%<LOW>  L%
%<HIGH>  H%
  }{%
    This letter class option file was made only\MessageBreak
    to be used with KOMA-Script letter class\MessageBreak
    `scrlttr2' or letter package `scrletter'.\MessageBreak
    Use with other classes and without that package\MessageBreak
    can result in a lot of errors%
  }%
}{}
%    \end{macrocode}
%
% Is the expected paper size used?
%    \begin{macrocode}
\LetterOptionNeedsPapersize{%
%<Ni>  Nippon%
%<Kaku>  Kaku%
%<EARLY>  E%
%<LATE>  L%
%<RIGHT>  R%
%<LOW>  L%
%<HIGH>  H%
}{a4}
%    \end{macrocode}
%
% All the values
% \begin{variable}{fromzipcode}
% \changes{v3.03}{2009/03/04}{set term of variable \texttt{fromzipcode}}
%    \begin{macrocode}
\setkomavar*{fromzipcode}{J}
%    \end{macrocode}
% \end{variable}
% \begin{pseudolength}{foldmarkhpos,
%                      tfoldmarkvpos,tfoldmarklength,
%                      mfoldmarkvpos,mfoldmarklength,
%                      bfoldmarkvpos,bfoldmarklength,
%                      foldmarkvpos,lfoldmarkhpos}
% The fold marks. All of them are universal for Japanese \file{lco}-files.
%    \begin{macrocode}
\setplength{foldmarkhpos}{3.5mm}
\setplength{tfoldmarkvpos}{83mm}
\setplength{tfoldmarklength}{4mm}
\setplength{mfoldmarkvpos}{116mm}
\setplength{mfoldmarklength}{2mm}
\setplength{bfoldmarkvpos}{232mm}
\setplength{bfoldmarklength}{2mm}
\setplength{foldmarkvpos}{3.5mm}
\setplength{lfoldmarkhpos}{202mm}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{toaddrhpos,toaddrvpos,toaddrwidth,toaddrheight}
% The size and position of the address window. These values are the main
% difference of the envelopes. The original values (all in cm) by Gernot:
% \begin{center}
%   \begin{tabular}{lcccc}
%     \hline
%     Type & x & w & y & h \\
%     \hline
%     NipponEL & 22 & 90 & 12 & 45 \\
%     NipponEH & 22 & 90 & 12 & 55 \\
%     NipponLL & 25 & 90 & 12 & 45 \\
%     NipponLH & 25 & 90 & 12 & 55 \\
%     NipponRL & 98 & 90 & 28 & 45 \\
%     KakuLL   & 25 & 90 & 24 & 45 \\
%     \hline
%   \end{tabular}
% \end{center}
%    \begin{macrocode}
%<EARLY>\setplength{toaddrhpos}{22mm}
%<LATE>\setplength{toaddrhpos}{25mm}
%<RIGHT>\setplength{toaddrhpos}{-22mm}
\setplength{toaddrwidth}{90mm}
%<Ni&!RIGHT>\setplength{toaddrvpos}{12mm}
%<Ni&RIGHT>\setplength{toaddrvpos}{28mm}
%<Kaku>\setplength{toaddrvpos}{24mm}
%<LOW>\setplength{toaddrheight}{40mm}
%<HIGH>\setplength{toaddrheight}{50mm}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{toaddrindent,backaddrheight,
%                      specialmailindent,specialmailrightindent}
% These are also inside the address window and same for all Japanese
% envelopes.
%    \begin{macrocode}
\setplength{toaddrindent}{\z@}
\setplength{backaddrheight}{5mm}
\setplength{specialmailindent}{\fill}
\setplength{specialmailrightindent}{1em}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{locwidth,locheight}
% The location field also depends on the address field.
%    \begin{macrocode}
\setplength{locwidth}{\z@}
%<Ni>\setplength{locheight}{55mm}%
%<Kaku>\setplength{locheight}{45mm}%
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{refvpos,refwidth,refaftervskip}
% While the position of the reference line also depends on the address field,
% the space below it is fix. The zero of \plen{revwidth} is a magic. See
% \file{scrkernel-notepaper.dtx} for more information.
%    \begin{macrocode}
%<!Ni|!RIGHT>\setplength{refvpos}{69mm}
%<Ni&RIGHT>\setplength{refvpos}{84mm}
\setplength{refaftervskip}{\baselineskip}
\setplength{refwidth}{\z@}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstheadvpos,firstheadwidth}
% The header also depends on the address field. This is the reason we have
% not defined it first, despite it is the first field.
%    \begin{macrocode}
\setplength{firstheadvpos}{8mm}
\setplength{firstheadwidth}{\paperwidth}
\ifdim \useplength{toaddrhpos}>\z@
  \addtoplength[-2]{firstheadwidth}{\useplength{toaddrhpos}}
\else
  \addtoplength[2]{firstheadwidth}{\useplength{toaddrhpos}}
\fi
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstfootwidth,firstfootvpos}
% The width of the footer depends on the width of the header. The position
% depends on the paper height.
%    \begin{macrocode}
\setplength{firstfootwidth}{\useplength{firstheadwidth}}
\setplength{firstfootvpos}{\paperheight}
\addtoplength{firstfootvpos}{-16mm}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{sigindent,sigbeforevskip}
% Values of the signature
%    \begin{macrocode}
\setplength{sigindent}{\z@}
\setplength{sigbeforevskip}{2\baselineskip}
%    \end{macrocode}
% \end{pseudolength}
% \begin{command}{\raggedsignature}
% The signature is centered, but maybe this should be changed to
% \cs{raggedright}?
%    \begin{macrocode}
\let\raggedsignature=\centering
%    \end{macrocode}
% \end{command}
%
% \begin{option}{fromalign}
% The default alignment of the sender is in the location field.
%    \begin{macrocode}
\ifcase\@alignfrom
  \KOMAoptions{fromalign=locationright}%
\or
  \KOMAoptions{fromalign=locationright}%
\or
  \KOMAoptions{fromalign=locationright}%
\fi
%    \end{macrocode}
% \end{option}
%
%    \begin{macrocode}
%</body>
%</lco>
%    \end{macrocode}
%
% \Finale
% \PrintChanges
%
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
% End: