% \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:
